diff --git a/api/tests/movies/get-all-movies-with-null.test.ts b/api/tests/movies/get-all-movies-with-null.test.ts index 1abeed9c..893c4612 100644 --- a/api/tests/movies/get-all-movies-with-null.test.ts +++ b/api/tests/movies/get-all-movies-with-null.test.ts @@ -1,5 +1,4 @@ -import { afterAll, beforeAll, describe, expect, it } from "bun:test"; -import { eq } from "drizzle-orm"; +import { beforeAll, describe, expect, it } from "bun:test"; import { expectStatus } from "tests/utils"; import { seedMovie } from "~/controllers/seed/movies"; import { db } from "~/db"; @@ -7,15 +6,12 @@ import { shows } from "~/db/schema"; import { bubble } from "~/models/examples"; import { dune1984 } from "~/models/examples/dune-1984"; import { dune } from "~/models/examples/dune-2021"; -import { createMovie, getMovies, app } from "../helper"; +import { app, createMovie, getMovies } from "../helper"; beforeAll(async () => { await db.delete(shows); for (const movie of [bubble, dune1984, dune]) await seedMovie(movie); }); -afterAll(async () => { - await db.delete(shows); -}); describe("with a null value", () => { // Those before/after hooks are NOT scopped to the describe due to a bun bug @@ -47,9 +43,6 @@ describe("with a null value", () => { externalId: {}, }); }); - afterAll(async () => { - await db.delete(shows).where(eq(shows.slug, "no-air-date")); - }); it("sort by dates desc with a null value", async () => { let [resp, body] = await getMovies({ diff --git a/api/tests/movies/get-all-movies.test.ts b/api/tests/movies/get-all-movies.test.ts index 1a875dc6..a10c2f56 100644 --- a/api/tests/movies/get-all-movies.test.ts +++ b/api/tests/movies/get-all-movies.test.ts @@ -1,4 +1,4 @@ -import { afterAll, beforeAll, describe, expect, it } from "bun:test"; +import { beforeAll, describe, expect, it } from "bun:test"; import { expectStatus } from "tests/utils"; import { seedMovie } from "~/controllers/seed/movies"; import { db } from "~/db"; @@ -14,9 +14,6 @@ beforeAll(async () => { await db.delete(shows); for (const movie of [bubble, dune1984, dune]) await seedMovie(movie); }); -afterAll(async () => { - await db.delete(shows); -}); describe("Get all movies", () => { it("Invalid filter params", async () => { diff --git a/api/tests/movies/get-movie.test.ts b/api/tests/movies/get-movie.test.ts index eddf6664..675f1f70 100644 --- a/api/tests/movies/get-movie.test.ts +++ b/api/tests/movies/get-movie.test.ts @@ -8,7 +8,7 @@ let bubbleId = ""; beforeAll(async () => { const ret = await seedMovie(bubble); - if (ret.status !== 422) bubbleId = ret.id; + if (!("status" in ret)) bubbleId = ret.id; }); describe("Get movie", () => { diff --git a/api/tests/movies/seed-movies.test.ts b/api/tests/movies/seed-movies.test.ts index 33a709d3..03b84f41 100644 --- a/api/tests/movies/seed-movies.test.ts +++ b/api/tests/movies/seed-movies.test.ts @@ -1,14 +1,8 @@ -import { afterAll, beforeAll, describe, expect, it } from "bun:test"; +import { beforeAll, describe, expect, it } from "bun:test"; import { eq } from "drizzle-orm"; import { expectStatus } from "tests/utils"; import { db } from "~/db"; -import { - entries, - entryVideoJoin, - showTranslations, - shows, - videos, -} from "~/db/schema"; +import { showTranslations, shows, videos } from "~/db/schema"; import { bubble } from "~/models/examples"; import { dune, duneVideo } from "~/models/examples/dune-2021"; import { createMovie, createVideo } from "../helper"; @@ -388,6 +382,7 @@ describe("Movie seeding", () => { }, ]); expectStatus(vresp, video).toBe(201); + console.log(video); const [resp, body] = await createMovie({ ...bubble, @@ -395,7 +390,7 @@ describe("Movie seeding", () => { videos: [video[0].id, video[1].id], }); expectStatus(resp, body).toBe(201); - console.log(body) + console.log(body); const ret = await db.query.shows.findFirst({ where: eq(shows.id, body.id), @@ -415,10 +410,7 @@ describe("Movie seeding", () => { const cleanup = async () => { await db.delete(shows); - await db.delete(entries); - await db.delete(entryVideoJoin); await db.delete(videos); }; // cleanup db beforehand to unsure tests are consistent beforeAll(cleanup); -afterAll(cleanup);