MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / createFetchMock

Function createFetchMock

api/vitest.utils.ts:263–270  ·  view source on GitHub ↗
({ ok = true, body = {} } = {})

Source from the content-addressed store, hash-verified

261}
262
263export function createFetchMock({ ok = true, body = {} } = {}) {
264 return vi.fn().mockResolvedValue(
265 Promise.resolve({
266 ok,
267 json: () => Promise.resolve(body)
268 })
269 );
270}
271
272/**
273 * Utility type to recursively replace `Date` with `string`.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected