blob: bb29155728841497a909832ece7478733b7f3a0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import * as Sentry from '~/sentry/sentry_browser_wrapper';
import { captureException } from '~/ci/runner/sentry_utils';
jest.mock('~/sentry/sentry_browser_wrapper');
describe('~/ci/runner/sentry_utils', () => {
describe('captureException', () => {
const mockError = new Error('Something went wrong!');
it('error is reported to sentry', () => {
captureException({ error: mockError });
expect(Sentry.captureException).toHaveBeenCalledWith(mockError);
});
it('error is reported to sentry with a component name', () => {
const mockComponentName = 'MyComponent';
captureException({ error: mockError, component: mockComponentName });
expect(Sentry.captureException).toHaveBeenCalledWith(mockError, {
tags: {
vue_component: mockComponentName,
},
});
});
});
});
|