Mock fetch that returns 200 /me response for any request.
()
| 30 | |
| 31 | /** Mock fetch that returns 200 /me response for any request. */ |
| 32 | function makeOkFetch(): InitDeps['fetchImpl'] { |
| 33 | return vi.fn( |
| 34 | async () => |
| 35 | new Response(JSON.stringify(ME), { |
| 36 | status: 200, |
| 37 | headers: { 'content-type': 'application/json' }, |
| 38 | }), |
| 39 | ) as unknown as InitDeps['fetchImpl']; |
| 40 | } |
| 41 | |
| 42 | /** Mock fetch that returns 401 for any request (simulates bad key). */ |
| 43 | function makeAuthFailFetch(): InitDeps['fetchImpl'] { |