blob: 293ceb26f6d74cbdbefa4dd632ff8992f7dfe77c [file] [log] [blame]
SurenNewareb31a4482020-12-29 20:55:02 +05301import { mount, createLocalVue } from '@vue/test-utils';
2import LoadingBar from '@/components/Global/LoadingBar';
3import BootstrapVue from 'bootstrap-vue';
4
5const localVue = createLocalVue();
6localVue.use(BootstrapVue);
7
8describe('LoadingBar.vue', () => {
9 const wrapper = mount(LoadingBar, {
10 localVue,
11 data() {
12 return {
13 loadingIndicatorValue: 0,
14 isLoadingComplete: false,
15 };
16 },
17 mocks: {
18 $t: (key) => key,
19 },
20 });
21 it('should exist', () => {
22 expect(wrapper.exists()).toBe(true);
23 });
24 it('should show loading bar element', async () => {
25 await wrapper.setData({
26 isLoadingComplete: false,
27 loadingIndicatorValue: 100,
28 });
29 expect(wrapper.vm.isLoadingComplete).toBe(false);
30 expect(wrapper.find('.progress').exists()).toBe(true);
31 });
32 it('should hide loading bar element', async () => {
33 await wrapper.setData({
34 isLoadingComplete: true,
35 loadingIndicatorValue: 0,
36 });
37 expect(wrapper.vm.isLoadingComplete).toBe(true);
38 expect(wrapper.find('.progress').exists()).toBe(false);
39 });
40 it('should render correctly', () => {
41 expect(wrapper.element).toMatchSnapshot();
42 });
43});