blob: e6f7082d280003377ce6116f49ae1fca8b565b82 (
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
29
30
31
|
import { displayAndLogError, getEventIcon } from '~/issues/show/components/incidents/utils';
import { createAlert } from '~/flash';
jest.mock('~/flash');
describe('incident utils', () => {
describe('display and log error', () => {
it('displays and logs an error', () => {
const error = new Error('test');
displayAndLogError(error);
expect(createAlert).toHaveBeenCalledWith({
message: 'Something went wrong while fetching incident timeline events.',
captureError: true,
error,
});
});
});
describe('get event icon', () => {
it('should display a matching event icon name', () => {
const name = 'comment';
expect(getEventIcon(name)).toBe(name);
});
it('should return a default icon name', () => {
expect(getEventIcon('non-existent-icon-name')).toBe('comment');
});
});
});
|