blob: 59d386a5899e3a4716ad1c590a6144dfe78ec774 (
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/browser';
import { captureException } from '~/ci/runner/sentry_utils';
jest.mock('@sentry/browser');
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,
},
});
});
});
});
|