summaryrefslogtreecommitdiff
path: root/spec/frontend/ide/stores/modules/editor/actions_spec.js
blob: 6a420ac32de562219b4493e22d99156ec3153a4f (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
import testAction from 'helpers/vuex_action_helper';
import * as types from '~/ide/stores/modules/editor/mutation_types';
import * as actions from '~/ide/stores/modules/editor/actions';
import { createTriggerRenamePayload } from '../../../helpers';

describe('~/ide/stores/modules/editor/actions', () => {
  describe('updateFileEditor', () => {
    it('commits with payload', () => {
      const payload = {};

      testAction(actions.updateFileEditor, payload, {}, [
        { type: types.UPDATE_FILE_EDITOR, payload },
      ]);
    });
  });

  describe('removeFileEditor', () => {
    it('commits with payload', () => {
      const payload = 'path/to/file.txt';

      testAction(actions.removeFileEditor, payload, {}, [
        { type: types.REMOVE_FILE_EDITOR, payload },
      ]);
    });
  });

  describe('renameFileEditor', () => {
    it('commits with payload', () => {
      const payload = createTriggerRenamePayload('test', 'test123');

      testAction(actions.renameFileEditor, payload, {}, [
        { type: types.RENAME_FILE_EDITOR, payload },
      ]);
    });
  });
});