summaryrefslogtreecommitdiff
path: root/tests/unit/AppNavigation.spec.js
blob: 3424f69828ceca66f4d36c7dfc4f1f59067f5b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { mount } from '@vue/test-utils';
import AppNavigation from '@/components/AppNavigation';
import Vue from 'vue';
import { BootstrapVue } from 'bootstrap-vue';

describe('AppNavigation.vue', () => {
  let wrapper;
  Vue.use(BootstrapVue);

  wrapper = mount(AppNavigation, {
    mocks: {
      $t: key => key
    }
  });

  describe('Component exists', () => {
    it('should check if AppNavigation exists', async () => {
      expect(wrapper.exists());
    });
  });

  describe('Methods', () => {
    describe('toggleIsOpen method', () => {
      it('should call toggleIsOpen and toggle isNavigationOpen to false', async () => {
        wrapper.vm.isNavigationOpen = true;
        wrapper.vm.toggleIsOpen();
        expect(wrapper.vm.isNavigationOpen).to.be.false;
      });

      it('should call toggleIsOpen and toggle isNavigationOpen to true', async () => {
        wrapper.vm.isNavigationOpen = false;
        wrapper.vm.toggleIsOpen();
        expect(wrapper.vm.isNavigationOpen).to.be.true;
      });
    });
  });
});