blob: 11373be578aa71eec29a486f66885545264dff57 (
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
32
33
34
35
36
37
38
39
40
41
42
43
|
import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount, mount } from '@vue/test-utils';
import mrStatusIcon from '~/vue_merge_request_widget/components/mr_widget_status_icon.vue';
describe('MR widget status icon component', () => {
let wrapper;
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const createWrapper = (props, mountFn = shallowMount) => {
wrapper = mountFn(mrStatusIcon, {
propsData: {
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
});
describe('while loading', () => {
it('renders loading icon', () => {
createWrapper({ status: 'loading' });
expect(findLoadingIcon().exists()).toBe(true);
});
});
describe('with status icon', () => {
it('renders success status icon', () => {
createWrapper({ status: 'success' }, mount);
expect(wrapper.find('[data-testid="status_success-icon"]').exists()).toBe(true);
});
it('renders failed status icon', () => {
createWrapper({ status: 'failed' }, mount);
expect(wrapper.find('[data-testid="status_failed-icon"]').exists()).toBe(true);
});
});
});
|