MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / assertSentryErrors

Function assertSentryErrors

packages/ember/tests/helpers/utils.ts:24–45  ·  view source on GitHub ↗
(
  assert: Assert,
  callNumber: number,
  options: {
    errorBodyContains: string[];
  },
)

Source from the content-addressed store, hash-verified

22}
23
24export 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
47export function assertSentryTransactions(
48 assert: Assert,

Callers 1

Calls 3

getTestSentryErrorsFunction · 0.85
assignMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected