| 8 | // return the thrown error (or null if it didn't throw). Validates the actual |
| 9 | // contract — not a hand-rolled mock of what we hope the middleware produces. |
| 10 | const invokeMiddleware = async (response: Response): Promise<unknown> => { |
| 11 | try { |
| 12 | await throwOnHttpError.onResponse!({ |
| 13 | request: new Request('https://example.test'), |
| 14 | response, |
| 15 | schemaPath: '/path', |
| 16 | params: {}, |
| 17 | options: {} as never, |
| 18 | id: 'test', |
| 19 | }); |
| 20 | return null; |
| 21 | } catch (e) { |
| 22 | return e; |
| 23 | } |
| 24 | }; |
| 25 | |
| 26 | describe('isUnauthorized', () => { |
| 27 | test('Octokit RequestError with status 401', () => { |