From 98c6263036f2ecc234703b837579352259e2a62c Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 2 Mar 2025 17:27:41 +0100 Subject: [PATCH] Add basic collection test --- api/tests/collection/seed-collection.test.ts | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 api/tests/collection/seed-collection.test.ts diff --git a/api/tests/collection/seed-collection.test.ts b/api/tests/collection/seed-collection.test.ts new file mode 100644 index 00000000..b1946813 --- /dev/null +++ b/api/tests/collection/seed-collection.test.ts @@ -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"); + }); +});