mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 00:25:38 -04:00
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:
@@ -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,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,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(() => {
|
||||
|
||||
Reference in New Issue
Block a user