mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 19:31:05 +00:00
Fix tests.
This commit is contained in:
parent
8c73b8d24e
commit
71d8fef10e
1 changed files with 13 additions and 4 deletions
|
@ -26,6 +26,8 @@ import {
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
const downloadFileSync = require("download-file-sync");
|
const downloadFileSync = require("download-file-sync");
|
||||||
|
|
||||||
|
const imageFetchLimit = 50;
|
||||||
|
|
||||||
beforeAll(setupLogins);
|
beforeAll(setupLogins);
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
@ -53,8 +55,13 @@ test("Upload image and delete it", async () => {
|
||||||
expect(listMediaRes.images.length).toBe(1);
|
expect(listMediaRes.images.length).toBe(1);
|
||||||
|
|
||||||
// Ensure that it also comes back with the admin all images
|
// Ensure that it also comes back with the admin all images
|
||||||
const listAllMediaRes = await alphaImage.listAllMedia();
|
const listAllMediaRes = await alphaImage.listAllMedia({
|
||||||
expect(listAllMediaRes.images.length).toBe(1);
|
limit: imageFetchLimit,
|
||||||
|
});
|
||||||
|
|
||||||
|
// This number comes from all the previous thumbnails fetched in other tests.
|
||||||
|
const previousThumbnails = 30;
|
||||||
|
expect(listAllMediaRes.images.length).toBe(previousThumbnails);
|
||||||
|
|
||||||
// The deleteUrl is a combination of the endpoint, delete token, and alias
|
// The deleteUrl is a combination of the endpoint, delete token, and alias
|
||||||
let firstImage = listMediaRes.images[0];
|
let firstImage = listMediaRes.images[0];
|
||||||
|
@ -78,8 +85,10 @@ test("Upload image and delete it", async () => {
|
||||||
expect(deletedListMediaRes.images.length).toBe(0);
|
expect(deletedListMediaRes.images.length).toBe(0);
|
||||||
|
|
||||||
// Ensure that the admin shows its deleted
|
// Ensure that the admin shows its deleted
|
||||||
const deletedListAllMediaRes = await alphaImage.listAllMedia();
|
const deletedListAllMediaRes = await alphaImage.listAllMedia({
|
||||||
expect(deletedListAllMediaRes.images.length).toBe(0);
|
limit: imageFetchLimit,
|
||||||
|
});
|
||||||
|
expect(deletedListAllMediaRes.images.length).toBe(previousThumbnails - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Purge user, uploaded image removed", async () => {
|
test("Purge user, uploaded image removed", async () => {
|
||||||
|
|
Loading…
Reference in a new issue