(
reply: { ok?: boolean; status?: number; body: string },
calls: FetchCall[],
)
| 15 | } |
| 16 | |
| 17 | function recordingFetch( |
| 18 | reply: { ok?: boolean; status?: number; body: string }, |
| 19 | calls: FetchCall[], |
| 20 | ): typeof globalThis.fetch { |
| 21 | return ((url: string, init?: RequestInit) => { |
| 22 | calls.push({ url, init }); |
| 23 | return Promise.resolve({ |
| 24 | ok: reply.ok ?? true, |
| 25 | status: reply.status ?? 200, |
| 26 | statusText: '', |
| 27 | text: () => Promise.resolve(reply.body), |
| 28 | }); |
| 29 | }) as unknown as typeof globalThis.fetch; |
| 30 | } |
| 31 | |
| 32 | function api(reply: { ok?: boolean; status?: number; body: string }): { api: AtlasApi; calls: FetchCall[] } { |
| 33 | const calls: FetchCall[] = []; |
no test coverage detected