summaryrefslogtreecommitdiff
path: root/tests/unit/Global/StatusIcon.spec.js
blob: 0fc8b7c91c76d7176495c8fe8eafec9b53c434b9 (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
import { mount, createLocalVue } from '@vue/test-utils';
import StatusIcon from '@/components/Global/StatusIcon';

const localVue = createLocalVue();

describe('StatusIcon.vue', () => {
  const wrapper = mount(StatusIcon, {
    localVue,
    propsData: {
      status: 'info',
    },
  });
  it('should exist', () => {
    expect(wrapper.exists()).toBe(true);
  });
  it('should render icon-info element', () => {
    expect(wrapper.find('.info').exists()).toBe(true);
  });
  it('should render icon-success element', async () => {
    await wrapper.setProps({ status: 'success' });
    expect(wrapper.find('.success').exists()).toBe(true);
  });
  it('should render icon-warning element', async () => {
    await wrapper.setProps({ status: 'warning' });
    expect(wrapper.find('.warning').exists()).toBe(true);
  });
  it('should render icon-danger element', async () => {
    await wrapper.setProps({ status: 'danger' });
    expect(wrapper.find('.danger').exists()).toBe(true);
  });
  it('should render icon-secondary element', async () => {
    await wrapper.setProps({ status: 'secondary' });
    expect(wrapper.find('.status-icon').exists()).toBe(true);
  });
  it('should render correctly', () => {
    expect(wrapper.element).toMatchSnapshot();
  });
});