Remove tmdbImageUrl mocks to fix cross-file mock poisoning in CI

bun's mock.module persists across test files in the same process,
causing image.test.ts to receive the stub instead of the real
tmdbImageUrl. Since tmdbImageUrl has no heavy runtime dependencies,
service tests work fine with the real implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 13:51:55 -05:00
co-authored by Claude Opus 4.6
parent 4cf326fa00
commit 8a3717cea7
3 changed files with 3 additions and 15 deletions
+1 -5
View File
@@ -2,10 +2,6 @@ import { beforeEach, describe, expect, mock, test } from "bun:test";
import { persons, titleCast } from "@/lib/db/schema";
import { clearAllTables, insertTitle, testDb } from "@/lib/test-utils";
mock.module("@/lib/tmdb/image", () => ({
tmdbImageUrl: (path: string | null) => path,
}));
mock.module("./image-cache", () => ({
imageCacheEnabled: () => false,
cacheProfilePhotos: async () => {},
@@ -65,7 +61,7 @@ describe("getCastForTitle", () => {
expect(cast).toHaveLength(2);
expect(cast[0].name).toBe("Actor One");
expect(cast[0].character).toBe("Hero");
expect(cast[0].profilePath).toBe("/path1.jpg");
expect(cast[0].profilePath).toBe("/api/images/profiles/path1.jpg");
expect(cast[1].name).toBe("Actor Two");
});
+1 -5
View File
@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, mock, test } from "bun:test";
import { beforeEach, describe, expect, test } from "bun:test";
import {
clearAllTables,
insertAvailabilityOffer,
@@ -12,10 +12,6 @@ import {
insertUser,
} from "@/lib/test-utils";
mock.module("@/lib/tmdb/image", () => ({
tmdbImageUrl: (path: string | null) => path,
}));
import {
getContinueWatchingFeed,
getNewAvailableFeed,
+1 -5
View File
@@ -1,11 +1,7 @@
import { beforeEach, describe, expect, mock, test } from "bun:test";
import { beforeEach, describe, expect, test } from "bun:test";
import { persons, titleCast } from "@/lib/db/schema";
import { clearAllTables, insertTitle, testDb } from "@/lib/test-utils";
mock.module("@/lib/tmdb/image", () => ({
tmdbImageUrl: (path: string | null) => path,
}));
import { getLocalFilmography } from "./person";
beforeEach(() => {