1import { mount } from '@vue/test-utils'; 2import LoadingBar from '@/components/Global/LoadingBar'; 3 4describe('LoadingBar.vue', () => { 5 const wrapper = mount(LoadingBar, { 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}); 39