diff options
Diffstat (limited to 'spec/frontend/ide/stores/modules/commit')
3 files changed, 26 insertions, 20 deletions
diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js index 5be0e22a9fc..b124eb391f3 100644 --- a/spec/frontend/ide/stores/modules/commit/actions_spec.js +++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js @@ -1,17 +1,20 @@ -import { file } from 'jest/ide/helpers'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import { visitUrl } from '~/lib/utils/url_utility'; -import { createStore } from '~/ide/stores'; -import service from '~/ide/services'; -import { createRouter } from '~/ide/ide_router'; +import { file } from 'jest/ide/helpers'; +import { commitActionTypes, PERMISSION_CREATE_MR } from '~/ide/constants'; import eventHub from '~/ide/eventhub'; -import consts from '~/ide/stores/modules/commit/constants'; -import * as mutationTypes from '~/ide/stores/modules/commit/mutation_types'; -import * as actions from '~/ide/stores/modules/commit/actions'; +import { createRouter } from '~/ide/ide_router'; import { createUnexpectedCommitError } from '~/ide/lib/errors'; -import { commitActionTypes, PERMISSION_CREATE_MR } from '~/ide/constants'; +import service from '~/ide/services'; +import { createStore } from '~/ide/stores'; +import * as actions from '~/ide/stores/modules/commit/actions'; +import { + COMMIT_TO_CURRENT_BRANCH, + COMMIT_TO_NEW_BRANCH, +} from '~/ide/stores/modules/commit/constants'; +import * as mutationTypes from '~/ide/stores/modules/commit/mutation_types'; +import { visitUrl } from '~/lib/utils/url_utility'; jest.mock('~/lib/utils/url_utility', () => ({ ...jest.requireActual('~/lib/utils/url_utility'), @@ -425,12 +428,12 @@ describe('IDE commit module actions', () => { }); it('resets stores commit actions', (done) => { - store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; + store.state.commit.commitAction = COMMIT_TO_NEW_BRANCH; store .dispatch('commit/commitChanges') .then(() => { - expect(store.state.commit.commitAction).not.toBe(consts.COMMIT_TO_NEW_BRANCH); + expect(store.state.commit.commitAction).not.toBe(COMMIT_TO_NEW_BRANCH); }) .then(done) .catch(done.fail); @@ -450,7 +453,7 @@ describe('IDE commit module actions', () => { it('redirects to new merge request page', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(); - store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; + store.state.commit.commitAction = COMMIT_TO_NEW_BRANCH; store.state.commit.shouldCreateMR = true; store @@ -468,7 +471,7 @@ describe('IDE commit module actions', () => { it('does not redirect to new merge request page when shouldCreateMR is not checked', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(); - store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; + store.state.commit.commitAction = COMMIT_TO_NEW_BRANCH; store.state.commit.shouldCreateMR = false; store @@ -483,7 +486,7 @@ describe('IDE commit module actions', () => { it('does not redirect to merge request page if shouldCreateMR is checked, but branch is the default branch', async () => { jest.spyOn(eventHub, '$on').mockImplementation(); - store.state.commit.commitAction = consts.COMMIT_TO_CURRENT_BRANCH; + store.state.commit.commitAction = COMMIT_TO_CURRENT_BRANCH; store.state.commit.shouldCreateMR = true; await store.dispatch('commit/commitChanges'); diff --git a/spec/frontend/ide/stores/modules/commit/getters_spec.js b/spec/frontend/ide/stores/modules/commit/getters_spec.js index 66ed51dbd13..0dc938bb637 100644 --- a/spec/frontend/ide/stores/modules/commit/getters_spec.js +++ b/spec/frontend/ide/stores/modules/commit/getters_spec.js @@ -1,6 +1,9 @@ -import commitState from '~/ide/stores/modules/commit/state'; +import { + COMMIT_TO_CURRENT_BRANCH, + COMMIT_TO_NEW_BRANCH, +} from '~/ide/stores/modules/commit/constants'; import * as getters from '~/ide/stores/modules/commit/getters'; -import consts from '~/ide/stores/modules/commit/constants'; +import commitState from '~/ide/stores/modules/commit/state'; describe('IDE commit module getters', () => { let state; @@ -147,13 +150,13 @@ describe('IDE commit module getters', () => { describe('isCreatingNewBranch', () => { it('returns false if NOT creating a new branch', () => { - state.commitAction = consts.COMMIT_TO_CURRENT_BRANCH; + state.commitAction = COMMIT_TO_CURRENT_BRANCH; expect(getters.isCreatingNewBranch(state)).toBeFalsy(); }); it('returns true if creating a new branch', () => { - state.commitAction = consts.COMMIT_TO_NEW_BRANCH; + state.commitAction = COMMIT_TO_NEW_BRANCH; expect(getters.isCreatingNewBranch(state)).toBeTruthy(); }); diff --git a/spec/frontend/ide/stores/modules/commit/mutations_spec.js b/spec/frontend/ide/stores/modules/commit/mutations_spec.js index 6393a70eac6..50342832d75 100644 --- a/spec/frontend/ide/stores/modules/commit/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/commit/mutations_spec.js @@ -1,6 +1,6 @@ -import commitState from '~/ide/stores/modules/commit/state'; -import mutations from '~/ide/stores/modules/commit/mutations'; import * as types from '~/ide/stores/modules/commit/mutation_types'; +import mutations from '~/ide/stores/modules/commit/mutations'; +import commitState from '~/ide/stores/modules/commit/state'; describe('IDE commit module mutations', () => { let state; |