(body: { ok?: boolean; status?: number; json?: unknown; text?: string })
| 24 | } |
| 25 | |
| 26 | function mockResponse(body: { ok?: boolean; status?: number; json?: unknown; text?: string }) { |
| 27 | return { |
| 28 | ok: body.ok ?? true, |
| 29 | status: body.status ?? 200, |
| 30 | statusText: '', |
| 31 | headers: { get: () => null, getSetCookie: () => [], toRecord: () => ({}) }, |
| 32 | body: null, |
| 33 | text: async () => body.text ?? '', |
| 34 | json: async () => body.json ?? {}, |
| 35 | arrayBuffer: async () => new ArrayBuffer(0), |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | beforeEach(() => { |
| 40 | mockValidateUrlWithDNS.mockReset() |