( responses: Response[], calls: CallRecord[], )
| 28 | } |
| 29 | |
| 30 | function makeStubFetch( |
| 31 | responses: Response[], |
| 32 | calls: CallRecord[], |
| 33 | ): typeof globalThis.fetch { |
| 34 | let idx = 0; |
| 35 | return (async (_input: any, _init?: any) => { |
| 36 | calls.push({ ts: Date.now() }); |
| 37 | const response = responses[idx]; |
| 38 | if (!response) throw new Error(`stub fetch: no response for call ${idx + 1}`); |
| 39 | idx++; |
| 40 | return response; |
| 41 | }) as typeof globalThis.fetch; |
| 42 | } |
| 43 | |
| 44 | describe("generateVariant Retry-After handling", () => { |
| 45 | let tmpDir: string; |
no test coverage detected