(
assert: Assert,
callNumber: number,
options: {
errorBodyContains: string[];
},
)
| 22 | } |
| 23 | |
| 24 | export function assertSentryErrors( |
| 25 | assert: Assert, |
| 26 | callNumber: number, |
| 27 | options: { |
| 28 | errorBodyContains: string[]; |
| 29 | }, |
| 30 | ): void { |
| 31 | const sentryTestEvents = getTestSentryErrors(); |
| 32 | const assertOptions = Object.assign({}, defaultAssertOptions, options); |
| 33 | |
| 34 | const event = sentryTestEvents[callNumber]; |
| 35 | |
| 36 | /** |
| 37 | * Body could be parsed here to check exact properties, but that requires too much implementation specific detail, |
| 38 | * instead this loosely matches on contents to check the correct error is being sent. |
| 39 | */ |
| 40 | assert.ok(assertOptions.errorBodyContains.length, 'Must pass strings to check against error body'); |
| 41 | const errorBody = JSON.stringify(event); |
| 42 | assertOptions.errorBodyContains.forEach(bodyContent => { |
| 43 | assert.ok(errorBody.includes(bodyContent), `Checking that error body includes ${bodyContent}`); |
| 44 | }); |
| 45 | } |
| 46 | |
| 47 | export function assertSentryTransactions( |
| 48 | assert: Assert, |
no test coverage detected