Skip to content

Commit 487b327

Browse files
fix: make test context http.fetch use globalThis.fetch for proper mocking
The test context's http.fetch was hardcoded to return an empty Response(), preventing proper mocking of globalThis.fetch in tests. Now it delegates to globalThis.fetch so test mocks can properly intercept HTTP calls. Signed-off-by: betterclever <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-019c1a9e-e1f3-755b-99e7-5a617c149f9e Co-authored-by: Amp <[email protected]>
1 parent a5891a6 commit 487b327

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

worker/src/components/ai/__tests__/ai-agent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function createTestContext(overrides?: Partial<ExecutionContext>): ExecutionCont
5353
},
5454
},
5555
http: {
56-
fetch: async () => new Response(),
56+
fetch: (url, init) => globalThis.fetch(url, init),
5757
toCurl: () => '',
5858
},
5959
...overrides,

0 commit comments

Comments
 (0)