(init: {
ok: boolean
status?: number
json: () => Promise<unknown>
})
| 31 | // to stamp span attributes, so mock responses need both fields or the call |
| 32 | // path throws before the route handler sees the body. |
| 33 | function buildMockResponse(init: { |
| 34 | ok: boolean |
| 35 | status?: number |
| 36 | json: () => Promise<unknown> |
| 37 | }): Record<string, unknown> { |
| 38 | return { |
| 39 | ok: init.ok, |
| 40 | status: init.status ?? (init.ok ? 200 : 500), |
| 41 | headers: new Headers(), |
| 42 | json: init.json, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | describe('Copilot API Keys API Route', () => { |
| 47 | beforeEach(() => { |