Add basic collection test

This commit is contained in:
Zoe Roux 2025-03-02 17:27:41 +01:00
parent 4538d9ce98
commit 98c6263036
No known key found for this signature in database

View File

@ -0,0 +1,24 @@
import { beforeAll, describe, expect, it } from "bun:test";
import { createMovie } from "tests/helpers";
import { expectStatus } from "tests/utils";
import { db } from "~/db";
import { shows } from "~/db/schema";
import { dune } from "~/models/examples/dune-2021";
import { duneCollection } from "~/models/examples/dune-collection";
beforeAll(async () => {
await db.delete(shows);
});
describe("Collection seeding", () => {
it("Can create a movie with a collection", async () => {
const [resp, body] = await createMovie({
...dune,
collection: duneCollection,
});
expectStatus(resp, body).toBe(201);
expect(body.id).toBeString();
expect(body.slug).toBe("dune");
expect(body.collection.slug).toBe("dune-collection");
});
});