MCPcopy Create free account
hub / github.com/microsoft/TypeChat / setupFetch

Function setupFetch

typescript/tests/model.test.mjs:73–82  ·  view source on GitHub ↗
(responses)

Source from the content-addressed store, hash-verified

71let mockResponses = [];
72
73function setupFetch(responses) {
74 capturedRequests = [];
75 mockResponses = [...responses];
76 globalThis.fetch = async (url, options) => {
77 capturedRequests.push({ url, options });
78 const resp = mockResponses.shift();
79 if (!resp) throw new Error("No mock response configured");
80 return resp;
81 };
82}
83
84function teardownFetch() {
85 delete globalThis.fetch;

Callers 1

model.test.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…