Sukanya Pandey | 88ac70f | 2020-12-31 14:27:22 +0530 | [diff] [blame] | 1 | import { mount, createLocalVue } from '@vue/test-utils'; |
| 2 | import StatusIcon from '@/components/Global/StatusIcon'; |
| 3 | |
| 4 | const localVue = createLocalVue(); |
| 5 | |
| 6 | describe('StatusIcon.vue', () => { |
| 7 | const wrapper = mount(StatusIcon, { |
| 8 | localVue, |
| 9 | propsData: { |
| 10 | status: 'info', |
| 11 | }, |
| 12 | }); |
| 13 | it('should exist', () => { |
| 14 | expect(wrapper.exists()).toBe(true); |
| 15 | }); |
| 16 | it('should render icon-info element', () => { |
| 17 | expect(wrapper.find('.info').exists()).toBe(true); |
| 18 | }); |
| 19 | it('should render icon-success element', async () => { |
| 20 | await wrapper.setProps({ status: 'success' }); |
| 21 | expect(wrapper.find('.success').exists()).toBe(true); |
| 22 | }); |
| 23 | it('should render icon-warning element', async () => { |
| 24 | await wrapper.setProps({ status: 'warning' }); |
| 25 | expect(wrapper.find('.warning').exists()).toBe(true); |
| 26 | }); |
| 27 | it('should render icon-danger element', async () => { |
| 28 | await wrapper.setProps({ status: 'danger' }); |
| 29 | expect(wrapper.find('.danger').exists()).toBe(true); |
| 30 | }); |
| 31 | it('should render icon-secondary element', async () => { |
| 32 | await wrapper.setProps({ status: 'secondary' }); |
| 33 | expect(wrapper.find('.status-icon').exists()).toBe(true); |
| 34 | }); |
| 35 | it('should render correctly', () => { |
| 36 | expect(wrapper.element).toMatchSnapshot(); |
| 37 | }); |
| 38 | }); |