MCPcopy Index your code
hub / github.com/coder/mux / mockFetch

Function mockFetch

src/node/services/serverAuthService.test.ts:17–25  ·  view source on GitHub ↗
(
  fn: (input: string | URL, init?: RequestInit) => Response | Promise<Response>
)

Source from the content-addressed store, hash-verified

15}
16
17function mockFetch(
18 fn: (input: string | URL, init?: RequestInit) => Response | Promise<Response>
19): void {
20 globalThis.fetch = Object.assign(fn, {
21 preconnect: (_url: string | URL) => {
22 // no-op in tests
23 },
24 }) as typeof fetch;
25}
26
27function setMockFetchForSuccessfulGithubLogin(login = "octocat"): void {
28 mockFetch((input) => {

Calls

no outgoing calls

Tested by

no test coverage detected