blob: 5191212d516e48e36bd7cfe3f7e0f524ed6ec45f [file] [log] [blame]
Ed Tanous7d6b44c2024-03-23 14:56:34 -07001import { mount } from '@vue/test-utils';
SurenNewareb31a4482020-12-29 20:55:02 +05302import LoadingBar from '@/components/Global/LoadingBar';
SurenNewareb31a4482020-12-29 20:55:02 +05303
4describe('LoadingBar.vue', () => {
5 const wrapper = mount(LoadingBar, {
SurenNewareb31a4482020-12-29 20:55:02 +05306 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});