MCPcopy Create free account
hub / github.com/Effect-TS/effect / stubFetch

Function stubFetch

packages/effect/test/http/FetchHttpClient.test.ts:100–108  ·  view source on GitHub ↗
(label: string)

Source from the content-addressed store, hash-verified

98 Effect.gen(function*() {
99 const calls: Array<string> = []
100 const stubFetch = (label: string) => {
101 vi.stubGlobal(
102 "fetch",
103 makeFetch(async () => {
104 calls.push(label)
105 return new Response()
106 })
107 )
108 }
109 stubFetch("first")
110 const client = yield* HttpClient.HttpClient
111 yield* client.get("https://example.test/1")

Callers 1

Calls 2

makeFetchFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected