* Captures the URL of the last fetch call and returns a valid JSON response so * `requestJson`'s response validation passes.
(body: unknown)
| 12 | * `requestJson`'s response validation passes. |
| 13 | */ |
| 14 | function mockFetchReturning(body: unknown) { |
| 15 | const fetchMock = vi.fn( |
| 16 | async () => |
| 17 | new Response(JSON.stringify(body), { |
| 18 | status: 200, |
| 19 | headers: { 'content-type': 'application/json' }, |
| 20 | }) |
| 21 | ) |
| 22 | vi.stubGlobal('fetch', fetchMock) |
| 23 | return fetchMock |
| 24 | } |
| 25 | |
| 26 | describe('requestJson query serialization', () => { |
| 27 | afterEach(() => { |