MCPcopy Index your code
hub / github.com/simstudioai/sim / createMockFetch

Function createMockFetch

packages/testing/src/mocks/fetch.mock.ts:28–34  ·  view source on GitHub ↗
(defaultResponse: MockFetchResponse = {})

Source from the content-addressed store, hash-verified

26 * ```
27 */
28export function createMockFetch(defaultResponse: MockFetchResponse = {}) {
29 const mockFn = vi.fn(async (_url: string | URL | Request, _init?: RequestInit) => {
30 return createMockResponse(defaultResponse)
31 })
32
33 return mockFn
34}
35
36/**
37 * Creates a mock Response object.

Callers 3

setupFetchMockFunction · 0.90
oauth.test.tsFile · 0.90
setupGlobalFetchMockFunction · 0.85

Calls 1

createMockResponseFunction · 0.70

Tested by 1

setupFetchMockFunction · 0.72