(answer: () => Response | Promise<Response>)
| 123 | |
| 124 | /** Autumn answering every request with `answer`, recording each request. */ |
| 125 | const autumnAnswers = (answer: () => Response | Promise<Response>) => { |
| 126 | globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => { |
| 127 | requests.push({ |
| 128 | url: String(input), |
| 129 | method: init?.method ?? "GET", |
| 130 | body: String(init?.body), |
| 131 | }); |
| 132 | return answer(); |
| 133 | }) as typeof fetch; |
| 134 | }; |
| 135 | const customer = (subscriptions: ReadonlyArray<{ plan_id: string; status: string }>) => |
| 136 | Response.json({ id: ORG, name: null, balances: {}, subscriptions, purchases: [] }); |
| 137 |
no test coverage detected