xref: /openbmc/webui-vue/tests/unit/Global/StatusIcon.spec.js (revision 7d6b44cb263da09e575c7cb28cab88c1eb339c7b)
1import { mount } from '@vue/test-utils';
2import StatusIcon from '@/components/Global/StatusIcon';
3
4describe('StatusIcon.vue', () => {
5  const wrapper = mount(StatusIcon, {
6    propsData: {
7      status: 'info',
8    },
9  });
10  it('should exist', () => {
11    expect(wrapper.exists()).toBe(true);
12  });
13  it('should render icon-info element', () => {
14    expect(wrapper.find('.info').exists()).toBe(true);
15  });
16  it('should render icon-success element', async () => {
17    await wrapper.setProps({ status: 'success' });
18    expect(wrapper.find('.success').exists()).toBe(true);
19  });
20  it('should render icon-warning element', async () => {
21    await wrapper.setProps({ status: 'warning' });
22    expect(wrapper.find('.warning').exists()).toBe(true);
23  });
24  it('should render icon-danger element', async () => {
25    await wrapper.setProps({ status: 'danger' });
26    expect(wrapper.find('.danger').exists()).toBe(true);
27  });
28  it('should render icon-secondary element', async () => {
29    await wrapper.setProps({ status: 'secondary' });
30    expect(wrapper.find('.status-icon').exists()).toBe(true);
31  });
32  it('should render correctly', () => {
33    expect(wrapper.element).toMatchSnapshot();
34  });
35});
36