diff options
Diffstat (limited to 'spec/javascripts/ide/stores/modules')
8 files changed, 5 insertions, 312 deletions
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index 06b8b452319..34d97347438 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -396,7 +396,7 @@ describe('IDE commit module actions', () => { .then(() => { expect(visitUrl).toHaveBeenCalledWith( `webUrl/merge_requests/new?merge_request[source_branch]=${ - store.getters['commit/newBranchName'] + store.getters['commit/placeholderBranchName'] }&merge_request[target_branch]=master`, ); diff --git a/spec/javascripts/ide/stores/modules/commit/getters_spec.js b/spec/javascripts/ide/stores/modules/commit/getters_spec.js index 3f4bf407a1f..702e78ef773 100644 --- a/spec/javascripts/ide/stores/modules/commit/getters_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/getters_spec.js @@ -29,11 +29,11 @@ describe('IDE commit module getters', () => { }); }); - describe('newBranchName', () => { + describe('placeholderBranchName', () => { it('includes username, currentBranchId, patch & random number', () => { gon.current_username = 'username'; - const branch = getters.newBranchName(state, null, { + const branch = getters.placeholderBranchName(state, null, { currentBranchId: 'testing', }); @@ -46,7 +46,7 @@ describe('IDE commit module getters', () => { currentBranchId: 'master', }; const localGetters = { - newBranchName: 'newBranchName', + placeholderBranchName: 'newBranchName', }; beforeEach(() => { @@ -71,7 +71,7 @@ describe('IDE commit module getters', () => { expect(getters.branchName(state, localGetters, rootState)).toBe('state-newBranchName'); }); - it('uses getters newBranchName when state newBranchName is empty', () => { + it('uses placeholderBranchName when state newBranchName is empty', () => { Object.assign(state, { newBranchName: '', }); diff --git a/spec/javascripts/ide/stores/modules/commit/mutations_spec.js b/spec/javascripts/ide/stores/modules/commit/mutations_spec.js deleted file mode 100644 index 5de7a281d34..00000000000 --- a/spec/javascripts/ide/stores/modules/commit/mutations_spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import commitState from '~/ide/stores/modules/commit/state'; -import mutations from '~/ide/stores/modules/commit/mutations'; - -describe('IDE commit module mutations', () => { - let state; - - beforeEach(() => { - state = commitState(); - }); - - describe('UPDATE_COMMIT_MESSAGE', () => { - it('updates commitMessage', () => { - mutations.UPDATE_COMMIT_MESSAGE(state, 'testing'); - - expect(state.commitMessage).toBe('testing'); - }); - }); - - describe('UPDATE_COMMIT_ACTION', () => { - it('updates commitAction', () => { - mutations.UPDATE_COMMIT_ACTION(state, 'testing'); - - expect(state.commitAction).toBe('testing'); - }); - }); - - describe('UPDATE_NEW_BRANCH_NAME', () => { - it('updates newBranchName', () => { - mutations.UPDATE_NEW_BRANCH_NAME(state, 'testing'); - - expect(state.newBranchName).toBe('testing'); - }); - }); - - describe('UPDATE_LOADING', () => { - it('updates submitCommitLoading', () => { - mutations.UPDATE_LOADING(state, true); - - expect(state.submitCommitLoading).toBeTruthy(); - }); - }); -}); diff --git a/spec/javascripts/ide/stores/modules/file_templates/getters_spec.js b/spec/javascripts/ide/stores/modules/file_templates/getters_spec.js deleted file mode 100644 index 17cb457881f..00000000000 --- a/spec/javascripts/ide/stores/modules/file_templates/getters_spec.js +++ /dev/null @@ -1,59 +0,0 @@ -import createState from '~/ide/stores/state'; -import { activityBarViews } from '~/ide/constants'; -import * as getters from '~/ide/stores/modules/file_templates/getters'; - -describe('IDE file templates getters', () => { - describe('templateTypes', () => { - it('returns list of template types', () => { - expect(getters.templateTypes().length).toBe(4); - }); - }); - - describe('showFileTemplatesBar', () => { - let rootState; - - beforeEach(() => { - rootState = createState(); - }); - - it('returns true if template is found and currentActivityView is edit', () => { - rootState.currentActivityView = activityBarViews.edit; - - expect( - getters.showFileTemplatesBar( - null, - { - templateTypes: getters.templateTypes(), - }, - rootState, - )('LICENSE'), - ).toBe(true); - }); - - it('returns false if template is found and currentActivityView is not edit', () => { - rootState.currentActivityView = activityBarViews.commit; - - expect( - getters.showFileTemplatesBar( - null, - { - templateTypes: getters.templateTypes(), - }, - rootState, - )('LICENSE'), - ).toBe(false); - }); - - it('returns undefined if not found', () => { - expect( - getters.showFileTemplatesBar( - null, - { - templateTypes: getters.templateTypes(), - }, - rootState, - )('test'), - ).toBe(undefined); - }); - }); -}); diff --git a/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js b/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js deleted file mode 100644 index 8e0e3ae99a1..00000000000 --- a/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js +++ /dev/null @@ -1,69 +0,0 @@ -import createState from '~/ide/stores/modules/file_templates/state'; -import * as types from '~/ide/stores/modules/file_templates/mutation_types'; -import mutations from '~/ide/stores/modules/file_templates/mutations'; - -describe('IDE file templates mutations', () => { - let state; - - beforeEach(() => { - state = createState(); - }); - - describe(types.REQUEST_TEMPLATE_TYPES, () => { - it('sets isLoading', () => { - mutations[types.REQUEST_TEMPLATE_TYPES](state); - - expect(state.isLoading).toBe(true); - }); - }); - - describe(types.RECEIVE_TEMPLATE_TYPES_ERROR, () => { - it('sets isLoading', () => { - state.isLoading = true; - - mutations[types.RECEIVE_TEMPLATE_TYPES_ERROR](state); - - expect(state.isLoading).toBe(false); - }); - }); - - describe(types.RECEIVE_TEMPLATE_TYPES_SUCCESS, () => { - it('sets isLoading to false', () => { - state.isLoading = true; - - mutations[types.RECEIVE_TEMPLATE_TYPES_SUCCESS](state, []); - - expect(state.isLoading).toBe(false); - }); - - it('sets templates', () => { - mutations[types.RECEIVE_TEMPLATE_TYPES_SUCCESS](state, ['test']); - - expect(state.templates).toEqual(['test']); - }); - }); - - describe(types.SET_SELECTED_TEMPLATE_TYPE, () => { - it('sets selectedTemplateType', () => { - mutations[types.SET_SELECTED_TEMPLATE_TYPE](state, 'type'); - - expect(state.selectedTemplateType).toBe('type'); - }); - - it('clears templates', () => { - state.templates = ['test']; - - mutations[types.SET_SELECTED_TEMPLATE_TYPE](state, 'type'); - - expect(state.templates).toEqual([]); - }); - }); - - describe(types.SET_UPDATE_SUCCESS, () => { - it('sets updateSuccess', () => { - mutations[types.SET_UPDATE_SUCCESS](state, true); - - expect(state.updateSuccess).toBe(true); - }); - }); -}); diff --git a/spec/javascripts/ide/stores/modules/pane/getters_spec.js b/spec/javascripts/ide/stores/modules/pane/getters_spec.js deleted file mode 100644 index 8a213323de0..00000000000 --- a/spec/javascripts/ide/stores/modules/pane/getters_spec.js +++ /dev/null @@ -1,55 +0,0 @@ -import * as getters from '~/ide/stores/modules/pane/getters'; -import state from '~/ide/stores/modules/pane/state'; - -describe('IDE pane module getters', () => { - const TEST_VIEW = 'test-view'; - const TEST_KEEP_ALIVE_VIEWS = { - [TEST_VIEW]: true, - }; - - describe('isActiveView', () => { - it('returns true if given view matches currentView', () => { - const result = getters.isActiveView({ currentView: 'A' })('A'); - - expect(result).toBe(true); - }); - - it('returns false if given view does not match currentView', () => { - const result = getters.isActiveView({ currentView: 'A' })('B'); - - expect(result).toBe(false); - }); - }); - - describe('isAliveView', () => { - it('returns true if given view is in keepAliveViews', () => { - const result = getters.isAliveView({ keepAliveViews: TEST_KEEP_ALIVE_VIEWS }, {})(TEST_VIEW); - - expect(result).toBe(true); - }); - - it('returns true if given view is active view and open', () => { - const result = getters.isAliveView( - { ...state(), isOpen: true }, - { isActiveView: () => true }, - )(TEST_VIEW); - - expect(result).toBe(true); - }); - - it('returns false if given view is active view and closed', () => { - const result = getters.isAliveView(state(), { isActiveView: () => true })(TEST_VIEW); - - expect(result).toBe(false); - }); - - it('returns false if given view is not activeView', () => { - const result = getters.isAliveView( - { ...state(), isOpen: true }, - { isActiveView: () => false }, - )(TEST_VIEW); - - expect(result).toBe(false); - }); - }); -}); diff --git a/spec/javascripts/ide/stores/modules/pane/mutations_spec.js b/spec/javascripts/ide/stores/modules/pane/mutations_spec.js deleted file mode 100644 index b5fcd35912e..00000000000 --- a/spec/javascripts/ide/stores/modules/pane/mutations_spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import state from '~/ide/stores/modules/pane/state'; -import mutations from '~/ide/stores/modules/pane/mutations'; -import * as types from '~/ide/stores/modules/pane/mutation_types'; - -describe('IDE pane module mutations', () => { - const TEST_VIEW = 'test-view'; - let mockedState; - - beforeEach(() => { - mockedState = state(); - }); - - describe('SET_OPEN', () => { - it('sets isOpen', () => { - mockedState.isOpen = false; - - mutations[types.SET_OPEN](mockedState, true); - - expect(mockedState.isOpen).toBe(true); - }); - }); - - describe('SET_CURRENT_VIEW', () => { - it('sets currentView', () => { - mockedState.currentView = null; - - mutations[types.SET_CURRENT_VIEW](mockedState, TEST_VIEW); - - expect(mockedState.currentView).toEqual(TEST_VIEW); - }); - }); - - describe('KEEP_ALIVE_VIEW', () => { - it('adds entry to keepAliveViews', () => { - mutations[types.KEEP_ALIVE_VIEW](mockedState, TEST_VIEW); - - expect(mockedState.keepAliveViews).toEqual({ - [TEST_VIEW]: true, - }); - }); - }); -}); diff --git a/spec/javascripts/ide/stores/modules/pipelines/getters_spec.js b/spec/javascripts/ide/stores/modules/pipelines/getters_spec.js deleted file mode 100644 index 4514896b5ea..00000000000 --- a/spec/javascripts/ide/stores/modules/pipelines/getters_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -import * as getters from '~/ide/stores/modules/pipelines/getters'; -import state from '~/ide/stores/modules/pipelines/state'; - -describe('IDE pipeline getters', () => { - let mockedState; - - beforeEach(() => { - mockedState = state(); - }); - - describe('hasLatestPipeline', () => { - it('returns false when loading is true', () => { - mockedState.isLoadingPipeline = true; - - expect(getters.hasLatestPipeline(mockedState)).toBe(false); - }); - - it('returns false when pipelines is null', () => { - mockedState.latestPipeline = null; - - expect(getters.hasLatestPipeline(mockedState)).toBe(false); - }); - - it('returns false when loading is true & pipelines is null', () => { - mockedState.latestPipeline = null; - mockedState.isLoadingPipeline = true; - - expect(getters.hasLatestPipeline(mockedState)).toBe(false); - }); - - it('returns true when loading is false & pipelines is an object', () => { - mockedState.latestPipeline = { - id: 1, - }; - mockedState.isLoadingPipeline = false; - - expect(getters.hasLatestPipeline(mockedState)).toBe(true); - }); - }); -}); |