summaryrefslogtreecommitdiff
path: root/spec/frontend/ide/components/terminal_sync/terminal_sync_status_safe_spec.js
blob: 69077ef2c681e76185a5a8c6a3fe35e99c917c88 (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
38
39
40
41
42
43
44
45
46
47
import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import TerminalSyncStatus from '~/ide/components/terminal_sync/terminal_sync_status.vue';
import TerminalSyncStatusSafe from '~/ide/components/terminal_sync/terminal_sync_status_safe.vue';

const localVue = createLocalVue();
localVue.use(Vuex);

describe('ide/components/terminal_sync/terminal_sync_status_safe', () => {
  let store;
  let wrapper;

  const createComponent = () => {
    store = new Vuex.Store({
      state: {},
    });

    wrapper = shallowMount(TerminalSyncStatusSafe, {
      localVue,
      store,
    });
  };

  beforeEach(createComponent);

  afterEach(() => {
    wrapper.destroy();
  });

  describe('with terminal sync module in store', () => {
    beforeEach(() => {
      store.registerModule('terminalSync', {
        state: {},
      });
    });

    it('renders terminal sync status', () => {
      expect(wrapper.find(TerminalSyncStatus).exists()).toBe(true);
    });
  });

  describe('without terminal sync module', () => {
    it('does not render terminal sync status', () => {
      expect(wrapper.find(TerminalSyncStatus).exists()).toBe(false);
    });
  });
});