Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 1 | import { mount } from '@vue/test-utils'; |
SurenNeware | b31a448 | 2020-12-29 20:55:02 +0530 | [diff] [blame] | 2 | import LoadingBar from '@/components/Global/LoadingBar'; |
SurenNeware | b31a448 | 2020-12-29 20:55:02 +0530 | [diff] [blame] | 3 | |
| 4 | describe('LoadingBar.vue', () => { |
| 5 | const wrapper = mount(LoadingBar, { |
SurenNeware | b31a448 | 2020-12-29 20:55:02 +0530 | [diff] [blame] | 6 | data() { |
| 7 | return { |
| 8 | loadingIndicatorValue: 0, |
| 9 | isLoadingComplete: false, |
| 10 | }; |
| 11 | }, |
| 12 | mocks: { |
| 13 | $t: (key) => key, |
| 14 | }, |
| 15 | }); |
| 16 | it('should exist', () => { |
| 17 | expect(wrapper.exists()).toBe(true); |
| 18 | }); |
| 19 | it('should show loading bar element', async () => { |
| 20 | await wrapper.setData({ |
| 21 | isLoadingComplete: false, |
| 22 | loadingIndicatorValue: 100, |
| 23 | }); |
| 24 | expect(wrapper.vm.isLoadingComplete).toBe(false); |
| 25 | expect(wrapper.find('.progress').exists()).toBe(true); |
| 26 | }); |
| 27 | it('should hide loading bar element', async () => { |
| 28 | await wrapper.setData({ |
| 29 | isLoadingComplete: true, |
| 30 | loadingIndicatorValue: 0, |
| 31 | }); |
| 32 | expect(wrapper.vm.isLoadingComplete).toBe(true); |
| 33 | expect(wrapper.find('.progress').exists()).toBe(false); |
| 34 | }); |
| 35 | it('should render correctly', () => { |
| 36 | expect(wrapper.element).toMatchSnapshot(); |
| 37 | }); |
| 38 | }); |