xref: /openbmc/webui-vue/tests/unit/AppNavigation.spec.js (revision 98059c92dfc1b6f30ffbe02f4ae01e7cba30f8e9)
1import { mount } from '@vue/test-utils';
2import AppNavigation from '@/components/AppNavigation';
3import Vue from 'vue';
4import { BootstrapVue } from 'bootstrap-vue';
5
6describe('AppNavigation.vue', () => {
7  let wrapper;
8  Vue.use(BootstrapVue);
9
10  wrapper = mount(AppNavigation, {
11    mocks: {
12      $t: key => key
13    }
14  });
15
16  describe('Component exists', () => {
17    it('should check if AppNavigation exists', async () => {
18      expect(wrapper.exists());
19    });
20  });
21
22  describe('Methods', () => {
23    describe('toggleIsOpen method', () => {
24      it('should call toggleIsOpen and toggle isNavigationOpen to false', async () => {
25        wrapper.vm.isNavigationOpen = true;
26        wrapper.vm.toggleIsOpen();
27        expect(wrapper.vm.isNavigationOpen).to.be.false;
28      });
29
30      it('should call toggleIsOpen and toggle isNavigationOpen to true', async () => {
31        wrapper.vm.isNavigationOpen = false;
32        wrapper.vm.toggleIsOpen();
33        expect(wrapper.vm.isNavigationOpen).to.be.true;
34      });
35    });
36  });
37});
38