Welcome to mirror list, hosted at ThFree Co, Russian Federation.

actions_spec.js « store « edit « integrations « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ff881c265d6017c17fb14b899cf3b5656bb4fbf (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import testAction from 'helpers/vuex_action_helper';
import { refreshCurrentPage } from '~/lib/utils/url_utility';
import createState from '~/integrations/edit/store/state';
import {
  setOverride,
  setIsSaving,
  setIsTesting,
  setIsResetting,
  requestResetIntegration,
  receiveResetIntegrationSuccess,
  receiveResetIntegrationError,
} from '~/integrations/edit/store/actions';
import * as types from '~/integrations/edit/store/mutation_types';

jest.mock('~/lib/utils/url_utility');

describe('Integration form store actions', () => {
  let state;

  beforeEach(() => {
    state = createState();
  });

  describe('setOverride', () => {
    it('should commit override mutation', () => {
      return testAction(setOverride, true, state, [{ type: types.SET_OVERRIDE, payload: true }]);
    });
  });

  describe('setIsSaving', () => {
    it('should commit isSaving mutation', () => {
      return testAction(setIsSaving, true, state, [{ type: types.SET_IS_SAVING, payload: true }]);
    });
  });

  describe('setIsTesting', () => {
    it('should commit isTesting mutation', () => {
      return testAction(setIsTesting, true, state, [{ type: types.SET_IS_TESTING, payload: true }]);
    });
  });

  describe('setIsResetting', () => {
    it('should commit isResetting mutation', () => {
      return testAction(setIsResetting, true, state, [
        { type: types.SET_IS_RESETTING, payload: true },
      ]);
    });
  });

  describe('requestResetIntegration', () => {
    it('should commit REQUEST_RESET_INTEGRATION mutation', () => {
      return testAction(requestResetIntegration, null, state, [
        { type: types.REQUEST_RESET_INTEGRATION },
      ]);
    });
  });

  describe('receiveResetIntegrationSuccess', () => {
    it('should call refreshCurrentPage()', () => {
      return testAction(receiveResetIntegrationSuccess, null, state, [], [], () => {
        expect(refreshCurrentPage).toHaveBeenCalled();
      });
    });
  });

  describe('receiveResetIntegrationError', () => {
    it('should commit RECEIVE_RESET_INTEGRATION_ERROR mutation', () => {
      return testAction(receiveResetIntegrationError, null, state, [
        { type: types.RECEIVE_RESET_INTEGRATION_ERROR },
      ]);
    });
  });
});