diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/frontend/integrations/edit/store | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/frontend/integrations/edit/store')
4 files changed, 82 insertions, 2 deletions
diff --git a/spec/frontend/integrations/edit/store/actions_spec.js b/spec/frontend/integrations/edit/store/actions_spec.js index 5356c0a411b..5b5c8d6f76e 100644 --- a/spec/frontend/integrations/edit/store/actions_spec.js +++ b/spec/frontend/integrations/edit/store/actions_spec.js @@ -1,6 +1,11 @@ import testAction from 'helpers/vuex_action_helper'; import createState from '~/integrations/edit/store/state'; -import { setOverride } from '~/integrations/edit/store/actions'; +import { + setOverride, + setIsSaving, + setIsTesting, + setIsResetting, +} from '~/integrations/edit/store/actions'; import * as types from '~/integrations/edit/store/mutation_types'; describe('Integration form store actions', () => { @@ -15,4 +20,24 @@ describe('Integration form store actions', () => { 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 }, + ]); + }); + }); }); diff --git a/spec/frontend/integrations/edit/store/getters_spec.js b/spec/frontend/integrations/edit/store/getters_spec.js index 3353e0c84cc..7d4532a1059 100644 --- a/spec/frontend/integrations/edit/store/getters_spec.js +++ b/spec/frontend/integrations/edit/store/getters_spec.js @@ -1,5 +1,12 @@ -import { currentKey, isInheriting, propsSource } from '~/integrations/edit/store/getters'; +import { + currentKey, + isInheriting, + isDisabled, + propsSource, +} from '~/integrations/edit/store/getters'; import createState from '~/integrations/edit/store/state'; +import mutations from '~/integrations/edit/store/mutations'; +import * as types from '~/integrations/edit/store/mutation_types'; import { mockIntegrationProps } from '../mock_data'; describe('Integration form store getters', () => { @@ -45,6 +52,29 @@ describe('Integration form store getters', () => { }); }); + describe('isDisabled', () => { + it.each` + isSaving | isTesting | isResetting | expected + ${false} | ${false} | ${false} | ${false} + ${true} | ${false} | ${false} | ${true} + ${false} | ${true} | ${false} | ${true} + ${false} | ${false} | ${true} | ${true} + ${false} | ${true} | ${true} | ${true} + ${true} | ${false} | ${true} | ${true} + ${true} | ${true} | ${false} | ${true} + ${true} | ${true} | ${true} | ${true} + `( + 'when isSaving = $isSaving, isTesting = $isTesting, isResetting = $isResetting then isDisabled = $expected', + ({ isSaving, isTesting, isResetting, expected }) => { + mutations[types.SET_IS_SAVING](state, isSaving); + mutations[types.SET_IS_TESTING](state, isTesting); + mutations[types.SET_IS_RESETTING](state, isResetting); + + expect(isDisabled(state)).toBe(expected); + }, + ); + }); + describe('propsSource', () => { beforeEach(() => { state.defaultState = defaultState; diff --git a/spec/frontend/integrations/edit/store/mutations_spec.js b/spec/frontend/integrations/edit/store/mutations_spec.js index 4b733726d44..4707b4b3714 100644 --- a/spec/frontend/integrations/edit/store/mutations_spec.js +++ b/spec/frontend/integrations/edit/store/mutations_spec.js @@ -16,4 +16,28 @@ describe('Integration form store mutations', () => { expect(state.override).toBe(true); }); }); + + describe(`${types.SET_IS_SAVING}`, () => { + it('sets isSaving', () => { + mutations[types.SET_IS_SAVING](state, true); + + expect(state.isSaving).toBe(true); + }); + }); + + describe(`${types.SET_IS_TESTING}`, () => { + it('sets isTesting', () => { + mutations[types.SET_IS_TESTING](state, true); + + expect(state.isTesting).toBe(true); + }); + }); + + describe(`${types.SET_IS_RESETTING}`, () => { + it('sets isResetting', () => { + mutations[types.SET_IS_RESETTING](state, true); + + expect(state.isResetting).toBe(true); + }); + }); }); diff --git a/spec/frontend/integrations/edit/store/state_spec.js b/spec/frontend/integrations/edit/store/state_spec.js index fc193850a94..4d0f4a1da71 100644 --- a/spec/frontend/integrations/edit/store/state_spec.js +++ b/spec/frontend/integrations/edit/store/state_spec.js @@ -7,6 +7,7 @@ describe('Integration form state factory', () => { customState: {}, isSaving: false, isTesting: false, + isResetting: false, override: false, }); }); |