Skip to content

Commit 84bb4f3

Browse files
committed
test(producer): remote-media tests stub the download fetch seam
1 parent d5d455e commit 84bb4f3

2 files changed

Lines changed: 52 additions & 95 deletions

File tree

‎packages/producer/src/services/distributed/plan.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { tmpdir } from "node:os";
3030
import { join } from "node:path";
3131
import {
3232
applyConcreteGpuScreenshotClamp,
33+
_setDownloadFetchForTests,
3334
buildChromeArgs,
3435
FFMPEG_PATH_ENV,
3536
getFfmpegBinary,
@@ -707,12 +708,11 @@ describe("plan() — golden planDir + planHash determinism", () => {
707708
<video id="hero" src="https://cdn.example/missing.mp4" data-start="0"></video>
708709
</div>`,
709710
);
710-
const originalFetch = globalThis.fetch;
711711
let fetchCalls = 0;
712-
globalThis.fetch = (async () => {
712+
_setDownloadFetchForTests((async () => {
713713
fetchCalls += 1;
714714
return new Response(null, { status: 404, statusText: "Not Found" });
715-
}) as typeof fetch;
715+
}) as never);
716716

717717
let caught: unknown;
718718
try {
@@ -724,7 +724,7 @@ describe("plan() — golden planDir + planHash determinism", () => {
724724
} catch (err) {
725725
caught = err;
726726
} finally {
727-
globalThis.fetch = originalFetch;
727+
_setDownloadFetchForTests();
728728
}
729729

730730
expect(fetchCalls).toBeGreaterThan(0);

0 commit comments

Comments
 (0)