(fn: () => Promise<unknown>, expectedError: string | RegExp)
| 729 | } |
| 730 | |
| 731 | async function expectRejection(fn: () => Promise<unknown>, expectedError: string | RegExp) { |
| 732 | let error = '<blank>'; |
| 733 | |
| 734 | try { |
| 735 | await fn(); |
| 736 | } catch (e) { |
| 737 | error = (e as Error).message; |
| 738 | } |
| 739 | |
| 740 | if (typeof expectedError === 'string') { |
| 741 | expect(error).toContain(expectedError); |
| 742 | } else { |
| 743 | expect(error).toMatch(expectedError); |
| 744 | } |
| 745 | } |
no outgoing calls
no test coverage detected