Kyoo/api/tests/series/studios.test.ts
2025-03-03 09:36:38 +01:00

31 lines
890 B
TypeScript

import { beforeAll, describe, expect, it } from "bun:test";
import { getShowsByStudio } from "tests/helpers/studio-helper";
import { expectStatus } from "tests/utils";
import { seedSerie } from "~/controllers/seed/series";
import { madeInAbyss } from "~/models/examples";
beforeAll(async () => {
await seedSerie(madeInAbyss);
});
describe("Get by studio", () => {
it("Invalid slug", async () => {
const [resp, body] = await getShowsByStudio("sotneuhn", { langs: "en" });
expectStatus(resp, body).toBe(404);
expect(body).toMatchObject({
status: 404,
message: expect.any(String),
});
});
it("Get serie from studio", async () => {
const [resp, body] = await getShowsByStudio(madeInAbyss.studios[0].slug, {
langs: "en",
});
expectStatus(resp, body).toBe(200);
expect(body.items).toBeArrayOfSize(1);
expect(body.items[0].slug).toBe(madeInAbyss.slug);
});
});