mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
31 lines
878 B
TypeScript
31 lines
878 B
TypeScript
import { beforeAll, describe, expect, it } from "bun:test";
|
|
import { getEntries } from "tests/helpers";
|
|
import { expectStatus } from "tests/utils";
|
|
import { seedSerie } from "~/controllers/seed/series";
|
|
import { madeInAbyss } from "~/models/examples";
|
|
|
|
let miaId = "";
|
|
|
|
beforeAll(async () => {
|
|
const ret = await seedSerie(madeInAbyss);
|
|
if (!("status" in ret)) miaId = ret.id;
|
|
});
|
|
|
|
describe("Get entries", () => {
|
|
it("Invalid slug", async () => {
|
|
const [resp, body] = await getEntries("sotneuhn", { langs: "en" });
|
|
|
|
expectStatus(resp, body).toBe(404);
|
|
expect(body).toMatchObject({
|
|
status: 404,
|
|
message: expect.any(String),
|
|
});
|
|
});
|
|
it("Default sort order", async () => {
|
|
const [resp, body] = await getEntries(madeInAbyss.slug, { langs: "en" });
|
|
|
|
expectStatus(resp, body).toBe(200);
|
|
expect(body.items).toBeArrayOfSize(madeInAbyss.entries.length);
|
|
});
|
|
});
|