diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/ide/stores | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/ide/stores')
36 files changed, 183 insertions, 107 deletions
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 9d367714bbe..6178fb08d8c 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -1,12 +1,12 @@ -import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; -import axios from '~/lib/utils/axios_utils'; +import Vue from 'vue'; +import eventHub from '~/ide/eventhub'; +import { createRouter } from '~/ide/ide_router'; +import service from '~/ide/services'; import { createStore } from '~/ide/stores'; import * as actions from '~/ide/stores/actions/file'; import * as types from '~/ide/stores/mutation_types'; -import service from '~/ide/services'; -import { createRouter } from '~/ide/ide_router'; -import eventHub from '~/ide/eventhub'; +import axios from '~/lib/utils/axios_utils'; import { file, createTriggerRenameAction, createTriggerUpdatePayload } from '../../helpers'; const ORIGINAL_CONTENT = 'original content'; diff --git a/spec/frontend/ide/stores/actions/merge_request_spec.js b/spec/frontend/ide/stores/actions/merge_request_spec.js index 9b17d95ea35..600bd5fe9e1 100644 --- a/spec/frontend/ide/stores/actions/merge_request_spec.js +++ b/spec/frontend/ide/stores/actions/merge_request_spec.js @@ -1,19 +1,33 @@ import MockAdapter from 'axios-mock-adapter'; -import axios from '~/lib/utils/axios_utils'; -import { createStore } from '~/ide/stores'; +import { range } from 'lodash'; +import { TEST_HOST } from 'helpers/test_constants'; +import testAction from 'helpers/vuex_action_helper'; import { deprecatedCreateFlash as createFlash } from '~/flash'; +import { leftSidebarViews, PERMISSION_READ_MR, MAX_MR_FILES_AUTO_OPEN } from '~/ide/constants'; +import service from '~/ide/services'; +import { createStore } from '~/ide/stores'; import { getMergeRequestData, getMergeRequestChanges, getMergeRequestVersions, + openMergeRequestChanges, openMergeRequest, } from '~/ide/stores/actions/merge_request'; -import service from '~/ide/services'; -import { leftSidebarViews, PERMISSION_READ_MR } from '~/ide/constants'; +import * as types from '~/ide/stores/mutation_types'; +import axios from '~/lib/utils/axios_utils'; const TEST_PROJECT = 'abcproject'; const TEST_PROJECT_ID = 17; +const createMergeRequestChange = (path) => ({ + new_path: path, + path, +}); +const createMergeRequestChangesCount = (n) => + range(n).map((i) => createMergeRequestChange(`loremispum_${i}.md`)); + +const testGetUrlForPath = (path) => `${TEST_HOST}/test/${path}`; + jest.mock('~/flash'); describe('IDE store merge request actions', () => { @@ -353,6 +367,72 @@ describe('IDE store merge request actions', () => { }); }); + describe('openMergeRequestChanges', () => { + it.each` + desc | changes | entries + ${'with empty changes'} | ${[]} | ${{}} + ${'with changes not matching entries'} | ${[{ new_path: '123.md' }]} | ${{ '456.md': {} }} + `('$desc, does nothing', ({ changes, entries }) => { + const state = { entries }; + + return testAction({ + action: openMergeRequestChanges, + state, + payload: changes, + expectedActions: [], + expectedMutations: [], + }); + }); + + it('updates views and opens mr changes', () => { + // This is the payload sent to the action + const changesPayload = createMergeRequestChangesCount(15); + + // Remove some items from the payload to use for entries + const changes = changesPayload.slice(1, 14); + + const entries = changes.reduce( + (acc, { path }) => Object.assign(acc, { [path]: path, type: 'blob' }), + {}, + ); + const pathsToOpen = changes.slice(0, MAX_MR_FILES_AUTO_OPEN).map((x) => x.new_path); + + return testAction({ + action: openMergeRequestChanges, + state: { entries, getUrlForPath: testGetUrlForPath }, + payload: changesPayload, + expectedActions: [ + { type: 'updateActivityBarView', payload: leftSidebarViews.review.name }, + // Only activates first file + { type: 'router/push', payload: testGetUrlForPath(pathsToOpen[0]) }, + { type: 'setFileActive', payload: pathsToOpen[0] }, + // Fetches data for other files + ...pathsToOpen.slice(1).map((path) => ({ + type: 'getFileData', + payload: { path, makeFileActive: false }, + })), + ...pathsToOpen.slice(1).map((path) => ({ + type: 'getRawFileData', + payload: { path }, + })), + ], + expectedMutations: [ + ...changes.map((change) => ({ + type: types.SET_FILE_MERGE_REQUEST_CHANGE, + payload: { + file: entries[change.new_path], + mrChange: change, + }, + })), + ...pathsToOpen.map((path) => ({ + type: types.TOGGLE_FILE_OPEN, + payload: path, + })), + ], + }); + }); + }); + describe('openMergeRequest', () => { const mr = { projectId: TEST_PROJECT, @@ -409,7 +489,6 @@ describe('IDE store merge request actions', () => { case 'getFiles': case 'getMergeRequestVersions': case 'getBranchData': - case 'setFileMrChange': return Promise.resolve(); default: return originalDispatch(type, payload); @@ -445,6 +524,7 @@ describe('IDE store merge request actions', () => { ], ['getMergeRequestVersions', mr], ['getMergeRequestChanges', mr], + ['openMergeRequestChanges', testMergeRequestChanges.changes], ]); }) .then(done) @@ -454,9 +534,11 @@ describe('IDE store merge request actions', () => { it('updates activity bar view and gets file data, if changes are found', (done) => { store.state.entries.foo = { type: 'blob', + path: 'foo', }; store.state.entries.bar = { type: 'blob', + path: 'bar', }; testMergeRequestChanges.changes = [ @@ -467,24 +549,9 @@ describe('IDE store merge request actions', () => { openMergeRequest({ state: store.state, dispatch: store.dispatch, getters: mockGetters }, mr) .then(() => { expect(store.dispatch).toHaveBeenCalledWith( - 'updateActivityBarView', - leftSidebarViews.review.name, + 'openMergeRequestChanges', + testMergeRequestChanges.changes, ); - - testMergeRequestChanges.changes.forEach((change, i) => { - expect(store.dispatch).toHaveBeenCalledWith('setFileMrChange', { - file: store.state.entries[change.new_path], - mrChange: change, - }); - - expect(store.dispatch).toHaveBeenCalledWith('getFileData', { - path: change.new_path, - makeFileActive: i === 0, - openFile: true, - }); - }); - - expect(store.state.openFiles.length).toBe(testMergeRequestChanges.changes.length); }) .then(done) .catch(done.fail); diff --git a/spec/frontend/ide/stores/actions/project_spec.js b/spec/frontend/ide/stores/actions/project_spec.js index 1244c8af91a..23ffb5ff56b 100644 --- a/spec/frontend/ide/stores/actions/project_spec.js +++ b/spec/frontend/ide/stores/actions/project_spec.js @@ -1,7 +1,8 @@ import MockAdapter from 'axios-mock-adapter'; -import testAction from 'helpers/vuex_action_helper'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; -import axios from '~/lib/utils/axios_utils'; +import testAction from 'helpers/vuex_action_helper'; +import api from '~/api'; +import service from '~/ide/services'; import { createStore } from '~/ide/stores'; import { refreshLastCommitData, @@ -12,8 +13,7 @@ import { loadFile, loadBranch, } from '~/ide/stores/actions'; -import service from '~/ide/services'; -import api from '~/api'; +import axios from '~/lib/utils/axios_utils'; const TEST_PROJECT_ID = 'abc/def'; diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js index 7831df9f3a4..8de2188a5f4 100644 --- a/spec/frontend/ide/stores/actions/tree_spec.js +++ b/spec/frontend/ide/stores/actions/tree_spec.js @@ -1,12 +1,12 @@ import MockAdapter from 'axios-mock-adapter'; -import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'helpers/test_constants'; +import testAction from 'helpers/vuex_action_helper'; +import { createRouter } from '~/ide/ide_router'; +import service from '~/ide/services'; +import { createStore } from '~/ide/stores'; import { showTreeEntry, getFiles, setDirectoryData } from '~/ide/stores/actions/tree'; import * as types from '~/ide/stores/mutation_types'; import axios from '~/lib/utils/axios_utils'; -import { createStore } from '~/ide/stores'; -import service from '~/ide/services'; -import { createRouter } from '~/ide/ide_router'; import { file, createEntriesFromPaths } from '../../helpers'; describe('Multi-file store tree actions', () => { diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js index 036bc91cd11..d47dd88dd47 100644 --- a/spec/frontend/ide/stores/actions_spec.js +++ b/spec/frontend/ide/stores/actions_spec.js @@ -1,8 +1,8 @@ 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 eventHub from '~/ide/eventhub'; import { createRouter } from '~/ide/ide_router'; +import { createStore } from '~/ide/stores'; import { stageAllChanges, unstageAllChanges, @@ -18,10 +18,10 @@ import { createTempEntry, discardAllChanges, } from '~/ide/stores/actions'; -import axios from '~/lib/utils/axios_utils'; import * as types from '~/ide/stores/mutation_types'; +import axios from '~/lib/utils/axios_utils'; +import { visitUrl } from '~/lib/utils/url_utility'; import { file, createTriggerRenameAction, createTriggerChangeAction } from '../helpers'; -import eventHub from '~/ide/eventhub'; jest.mock('~/lib/utils/url_utility', () => ({ visitUrl: jest.fn(), diff --git a/spec/frontend/ide/stores/getters_spec.js b/spec/frontend/ide/stores/getters_spec.js index 1787f9e9361..450f5592026 100644 --- a/spec/frontend/ide/stores/getters_spec.js +++ b/spec/frontend/ide/stores/getters_spec.js @@ -1,6 +1,7 @@ import { TEST_HOST } from 'helpers/test_constants'; -import * as getters from '~/ide/stores/getters'; import { createStore } from '~/ide/stores'; +import * as getters from '~/ide/stores/getters'; +import { DEFAULT_PERMISSIONS } from '../../../../app/assets/javascripts/ide/constants'; import { file } from '../helpers'; const TEST_PROJECT_ID = 'test_project'; @@ -386,7 +387,9 @@ describe('IDE store getters', () => { describe('findProjectPermissions', () => { it('returns false if project not found', () => { - expect(localStore.getters.findProjectPermissions(TEST_PROJECT_ID)).toEqual({}); + expect(localStore.getters.findProjectPermissions(TEST_PROJECT_ID)).toEqual( + DEFAULT_PERMISSIONS, + ); }); it('finds permission in given project', () => { diff --git a/spec/frontend/ide/stores/modules/branches/actions_spec.js b/spec/frontend/ide/stores/modules/branches/actions_spec.js index b1c077c4082..135dbc1f746 100644 --- a/spec/frontend/ide/stores/modules/branches/actions_spec.js +++ b/spec/frontend/ide/stores/modules/branches/actions_spec.js @@ -1,8 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import axios from '~/lib/utils/axios_utils'; -import state from '~/ide/stores/modules/branches/state'; -import * as types from '~/ide/stores/modules/branches/mutation_types'; import { requestBranches, receiveBranchesError, @@ -10,6 +7,9 @@ import { fetchBranches, resetBranches, } from '~/ide/stores/modules/branches/actions'; +import * as types from '~/ide/stores/modules/branches/mutation_types'; +import state from '~/ide/stores/modules/branches/state'; +import axios from '~/lib/utils/axios_utils'; import { branches, projectData } from '../../../mock_data'; describe('IDE branches actions', () => { diff --git a/spec/frontend/ide/stores/modules/branches/mutations_spec.js b/spec/frontend/ide/stores/modules/branches/mutations_spec.js index ddf55479be9..fd6006749d2 100644 --- a/spec/frontend/ide/stores/modules/branches/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/branches/mutations_spec.js @@ -1,6 +1,6 @@ -import state from '~/ide/stores/modules/branches/state'; -import mutations from '~/ide/stores/modules/branches/mutations'; import * as types from '~/ide/stores/modules/branches/mutation_types'; +import mutations from '~/ide/stores/modules/branches/mutations'; +import state from '~/ide/stores/modules/branches/state'; import { branches } from '../../../mock_data'; describe('IDE branches mutations', () => { diff --git a/spec/frontend/ide/stores/modules/clientside/actions_spec.js b/spec/frontend/ide/stores/modules/clientside/actions_spec.js index 05627f8ed0e..c167d056039 100644 --- a/spec/frontend/ide/stores/modules/clientside/actions_spec.js +++ b/spec/frontend/ide/stores/modules/clientside/actions_spec.js @@ -1,8 +1,8 @@ import MockAdapter from 'axios-mock-adapter'; -import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'helpers/test_constants'; -import axios from '~/lib/utils/axios_utils'; +import testAction from 'helpers/vuex_action_helper'; import * as actions from '~/ide/stores/modules/clientside/actions'; +import axios from '~/lib/utils/axios_utils'; const TEST_PROJECT_URL = `${TEST_HOST}/lorem/ipsum`; const TEST_USAGE_URL = `${TEST_PROJECT_URL}/usage_ping/web_ide_clientside_preview`; 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; diff --git a/spec/frontend/ide/stores/modules/editor/actions_spec.js b/spec/frontend/ide/stores/modules/editor/actions_spec.js index 6a420ac32de..f006018364b 100644 --- a/spec/frontend/ide/stores/modules/editor/actions_spec.js +++ b/spec/frontend/ide/stores/modules/editor/actions_spec.js @@ -1,6 +1,6 @@ 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 * as types from '~/ide/stores/modules/editor/mutation_types'; import { createTriggerRenamePayload } from '../../../helpers'; describe('~/ide/stores/modules/editor/actions', () => { diff --git a/spec/frontend/ide/stores/modules/editor/getters_spec.js b/spec/frontend/ide/stores/modules/editor/getters_spec.js index 55e1e31f66f..14099cdaeb2 100644 --- a/spec/frontend/ide/stores/modules/editor/getters_spec.js +++ b/spec/frontend/ide/stores/modules/editor/getters_spec.js @@ -1,5 +1,5 @@ -import { createDefaultFileEditor } from '~/ide/stores/modules/editor/utils'; import * as getters from '~/ide/stores/modules/editor/getters'; +import { createDefaultFileEditor } from '~/ide/stores/modules/editor/utils'; const TEST_PATH = 'test/path.md'; const TEST_FILE_EDITOR = { diff --git a/spec/frontend/ide/stores/modules/editor/mutations_spec.js b/spec/frontend/ide/stores/modules/editor/mutations_spec.js index e4b330b3174..35d13f375a3 100644 --- a/spec/frontend/ide/stores/modules/editor/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/editor/mutations_spec.js @@ -1,6 +1,6 @@ -import { createDefaultFileEditor } from '~/ide/stores/modules/editor/utils'; import * as types from '~/ide/stores/modules/editor/mutation_types'; import mutations from '~/ide/stores/modules/editor/mutations'; +import { createDefaultFileEditor } from '~/ide/stores/modules/editor/utils'; import { createTriggerRenamePayload } from '../../../helpers'; const TEST_PATH = 'test/path.md'; diff --git a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js index 76898e83c7a..9ff950b0875 100644 --- a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js +++ b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js @@ -1,9 +1,9 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import axios from '~/lib/utils/axios_utils'; -import createState from '~/ide/stores/modules/file_templates/state'; import * as actions from '~/ide/stores/modules/file_templates/actions'; import * as types from '~/ide/stores/modules/file_templates/mutation_types'; +import createState from '~/ide/stores/modules/file_templates/state'; +import axios from '~/lib/utils/axios_utils'; describe('IDE file templates actions', () => { let state; diff --git a/spec/frontend/ide/stores/modules/file_templates/getters_spec.js b/spec/frontend/ide/stores/modules/file_templates/getters_spec.js index c9676b23fa1..e237b167f96 100644 --- a/spec/frontend/ide/stores/modules/file_templates/getters_spec.js +++ b/spec/frontend/ide/stores/modules/file_templates/getters_spec.js @@ -1,6 +1,6 @@ -import createState from '~/ide/stores/state'; import { leftSidebarViews } from '~/ide/constants'; import * as getters from '~/ide/stores/modules/file_templates/getters'; +import createState from '~/ide/stores/state'; describe('IDE file templates getters', () => { describe('templateTypes', () => { diff --git a/spec/frontend/ide/stores/modules/file_templates/mutations_spec.js b/spec/frontend/ide/stores/modules/file_templates/mutations_spec.js index 6a1a826093c..3ea3c9507dd 100644 --- a/spec/frontend/ide/stores/modules/file_templates/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/file_templates/mutations_spec.js @@ -1,6 +1,6 @@ -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'; +import createState from '~/ide/stores/modules/file_templates/state'; const mockFileTemplates = [['MIT'], ['CC']]; const mockTemplateType = 'test'; diff --git a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js index 6594d65f558..e1f2b165dd9 100644 --- a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js +++ b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js @@ -1,8 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import axios from '~/lib/utils/axios_utils'; -import state from '~/ide/stores/modules/merge_requests/state'; -import * as types from '~/ide/stores/modules/merge_requests/mutation_types'; import { requestMergeRequests, receiveMergeRequestsError, @@ -10,6 +7,9 @@ import { fetchMergeRequests, resetMergeRequests, } from '~/ide/stores/modules/merge_requests/actions'; +import * as types from '~/ide/stores/modules/merge_requests/mutation_types'; +import state from '~/ide/stores/modules/merge_requests/state'; +import axios from '~/lib/utils/axios_utils'; import { mergeRequests } from '../../../mock_data'; describe('IDE merge requests actions', () => { diff --git a/spec/frontend/ide/stores/modules/merge_requests/mutations_spec.js b/spec/frontend/ide/stores/modules/merge_requests/mutations_spec.js index d33bda3652d..f45c577f801 100644 --- a/spec/frontend/ide/stores/modules/merge_requests/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/merge_requests/mutations_spec.js @@ -1,7 +1,7 @@ import { TEST_HOST } from 'helpers/test_constants'; -import state from '~/ide/stores/modules/merge_requests/state'; -import mutations from '~/ide/stores/modules/merge_requests/mutations'; import * as types from '~/ide/stores/modules/merge_requests/mutation_types'; +import mutations from '~/ide/stores/modules/merge_requests/mutations'; +import state from '~/ide/stores/modules/merge_requests/state'; import { mergeRequests } from '../../../mock_data'; describe('IDE merge requests mutations', () => { diff --git a/spec/frontend/ide/stores/modules/pane/mutations_spec.js b/spec/frontend/ide/stores/modules/pane/mutations_spec.js index b5fcd35912e..eaeb2c8cd28 100644 --- a/spec/frontend/ide/stores/modules/pane/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/pane/mutations_spec.js @@ -1,6 +1,6 @@ -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'; +import mutations from '~/ide/stores/modules/pane/mutations'; +import state from '~/ide/stores/modules/pane/state'; describe('IDE pane module mutations', () => { const TEST_VIEW = 'test-view'; diff --git a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js index b7ed257e954..9aa31136c89 100644 --- a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js +++ b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js @@ -1,8 +1,8 @@ -import Visibility from 'visibilityjs'; import MockAdapter from 'axios-mock-adapter'; +import Visibility from 'visibilityjs'; import { TEST_HOST } from 'helpers/test_constants'; import testAction from 'helpers/vuex_action_helper'; -import axios from '~/lib/utils/axios_utils'; +import { rightSidebarViews } from '~/ide/constants'; import { requestLatestPipeline, receiveLatestPipelineError, @@ -22,9 +22,9 @@ import { fetchJobLogs, resetLatestPipeline, } from '~/ide/stores/modules/pipelines/actions'; -import state from '~/ide/stores/modules/pipelines/state'; import * as types from '~/ide/stores/modules/pipelines/mutation_types'; -import { rightSidebarViews } from '~/ide/constants'; +import state from '~/ide/stores/modules/pipelines/state'; +import axios from '~/lib/utils/axios_utils'; import { pipelines, jobs } from '../../../mock_data'; describe('IDE pipelines actions', () => { diff --git a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js index d820bf0291e..0e738b98918 100644 --- a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js @@ -1,6 +1,6 @@ +import * as types from '~/ide/stores/modules/pipelines/mutation_types'; import mutations from '~/ide/stores/modules/pipelines/mutations'; import state from '~/ide/stores/modules/pipelines/state'; -import * as types from '~/ide/stores/modules/pipelines/mutation_types'; import { fullPipelinesResponse, stages, jobs } from '../../../mock_data'; describe('IDE pipelines mutations', () => { diff --git a/spec/frontend/ide/stores/modules/router/mutations_spec.js b/spec/frontend/ide/stores/modules/router/mutations_spec.js index a4a83c9344d..5a9f266db94 100644 --- a/spec/frontend/ide/stores/modules/router/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/router/mutations_spec.js @@ -1,5 +1,5 @@ -import mutations from '~/ide/stores/modules/router/mutations'; import * as types from '~/ide/stores/modules/router/mutation_types'; +import mutations from '~/ide/stores/modules/router/mutations'; import createState from '~/ide/stores/modules/router/state'; const TEST_PATH = 'test/path/abc'; diff --git a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js index 05935f1db38..e5887ca0a33 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js @@ -1,14 +1,14 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'spec/test_constants'; +import * as actions from '~/ide/stores/modules/terminal/actions/checks'; import { CHECK_CONFIG, CHECK_RUNNERS, RETRY_RUNNERS_INTERVAL, } from '~/ide/stores/modules/terminal/constants'; -import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; import * as messages from '~/ide/stores/modules/terminal/messages'; -import * as actions from '~/ide/stores/modules/terminal/actions/checks'; +import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js index dd51786745f..e42e760b841 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js @@ -1,12 +1,12 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; +import * as actions from '~/ide/stores/modules/terminal/actions/session_controls'; import { STARTING, PENDING, STOPPING, STOPPED } from '~/ide/stores/modules/terminal/constants'; import * as messages from '~/ide/stores/modules/terminal/messages'; import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; -import * as actions from '~/ide/stores/modules/terminal/actions/session_controls'; -import httpStatus from '~/lib/utils/http_status'; import axios from '~/lib/utils/axios_utils'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; +import httpStatus from '~/lib/utils/http_status'; jest.mock('~/flash'); diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js index 0e123dce798..0227955754c 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js @@ -1,11 +1,11 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; +import * as actions from '~/ide/stores/modules/terminal/actions/session_status'; import { PENDING, RUNNING, STOPPING, STOPPED } from '~/ide/stores/modules/terminal/constants'; import * as messages from '~/ide/stores/modules/terminal/messages'; import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; -import * as actions from '~/ide/stores/modules/terminal/actions/session_status'; import axios from '~/lib/utils/axios_utils'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; jest.mock('~/flash'); diff --git a/spec/frontend/ide/stores/modules/terminal/actions/setup_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/setup_spec.js index 8bf3b58228e..a823c05c459 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/setup_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/setup_spec.js @@ -1,6 +1,6 @@ import testAction from 'helpers/vuex_action_helper'; -import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; import * as actions from '~/ide/stores/modules/terminal/actions/setup'; +import * as mutationTypes from '~/ide/stores/modules/terminal/mutation_types'; describe('IDE store terminal setup actions', () => { describe('init', () => { diff --git a/spec/frontend/ide/stores/modules/terminal/messages_spec.js b/spec/frontend/ide/stores/modules/terminal/messages_spec.js index 1bb92a9dfa5..e8f375a70b5 100644 --- a/spec/frontend/ide/stores/modules/terminal/messages_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/messages_spec.js @@ -1,8 +1,8 @@ import { escape } from 'lodash'; import { TEST_HOST } from 'spec/test_constants'; import * as messages from '~/ide/stores/modules/terminal/messages'; -import { sprintf } from '~/locale'; import httpStatus from '~/lib/utils/http_status'; +import { sprintf } from '~/locale'; const TEST_HELP_URL = `${TEST_HOST}/help`; diff --git a/spec/frontend/ide/stores/modules/terminal/mutations_spec.js b/spec/frontend/ide/stores/modules/terminal/mutations_spec.js index e9933bdd7be..3451932a185 100644 --- a/spec/frontend/ide/stores/modules/terminal/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/mutations_spec.js @@ -4,9 +4,9 @@ import { RUNNING, STOPPING, } from '~/ide/stores/modules/terminal/constants'; -import createState from '~/ide/stores/modules/terminal/state'; import * as types from '~/ide/stores/modules/terminal/mutation_types'; import mutations from '~/ide/stores/modules/terminal/mutations'; +import createState from '~/ide/stores/modules/terminal/state'; describe('IDE store terminal mutations', () => { let state; diff --git a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js index 2ae7e8a8727..22b0615c6d0 100644 --- a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js +++ b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js @@ -1,6 +1,6 @@ import testAction from 'helpers/vuex_action_helper'; -import * as actions from '~/ide/stores/modules/terminal_sync/actions'; import mirror, { canConnect, SERVICE_NAME } from '~/ide/lib/mirror'; +import * as actions from '~/ide/stores/modules/terminal_sync/actions'; import * as types from '~/ide/stores/modules/terminal_sync/mutation_types'; jest.mock('~/ide/lib/mirror'); diff --git a/spec/frontend/ide/stores/modules/terminal_sync/mutations_spec.js b/spec/frontend/ide/stores/modules/terminal_sync/mutations_spec.js index ecf35d60e96..b7dbf93f4e6 100644 --- a/spec/frontend/ide/stores/modules/terminal_sync/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/terminal_sync/mutations_spec.js @@ -1,6 +1,6 @@ -import createState from '~/ide/stores/modules/terminal_sync/state'; import * as types from '~/ide/stores/modules/terminal_sync/mutation_types'; import mutations from '~/ide/stores/modules/terminal_sync/mutations'; +import createState from '~/ide/stores/modules/terminal_sync/state'; const TEST_MESSAGE = 'lorem ipsum dolar sit'; diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js index 9bbdac0ae25..825d2a546cd 100644 --- a/spec/frontend/ide/stores/mutations/file_spec.js +++ b/spec/frontend/ide/stores/mutations/file_spec.js @@ -1,5 +1,5 @@ -import mutations from '~/ide/stores/mutations/file'; import { createStore } from '~/ide/stores'; +import mutations from '~/ide/stores/mutations/file'; import { file } from '../../helpers'; describe('IDE store file mutations', () => { diff --git a/spec/frontend/ide/stores/plugins/terminal_spec.js b/spec/frontend/ide/stores/plugins/terminal_spec.js index 948c2131fd8..d4cdad16ecb 100644 --- a/spec/frontend/ide/stores/plugins/terminal_spec.js +++ b/spec/frontend/ide/stores/plugins/terminal_spec.js @@ -2,8 +2,8 @@ import { createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import { TEST_HOST } from 'helpers/test_constants'; import terminalModule from '~/ide/stores/modules/terminal'; -import createTerminalPlugin from '~/ide/stores/plugins/terminal'; import { SET_BRANCH_WORKING_REFERENCE } from '~/ide/stores/mutation_types'; +import createTerminalPlugin from '~/ide/stores/plugins/terminal'; const TEST_DATASET = { eeWebTerminalSvgPath: `${TEST_HOST}/web/terminal/svg`, diff --git a/spec/frontend/ide/stores/plugins/terminal_sync_spec.js b/spec/frontend/ide/stores/plugins/terminal_sync_spec.js index 0e5f4184679..f12f80c1602 100644 --- a/spec/frontend/ide/stores/plugins/terminal_sync_spec.js +++ b/spec/frontend/ide/stores/plugins/terminal_sync_spec.js @@ -1,9 +1,9 @@ +import eventHub from '~/ide/eventhub'; +import { createStore } from '~/ide/stores'; +import { RUNNING, STOPPING } from '~/ide/stores/modules/terminal/constants'; +import { SET_SESSION_STATUS } from '~/ide/stores/modules/terminal/mutation_types'; import createTerminalPlugin from '~/ide/stores/plugins/terminal'; import createTerminalSyncPlugin from '~/ide/stores/plugins/terminal_sync'; -import { SET_SESSION_STATUS } from '~/ide/stores/modules/terminal/mutation_types'; -import { RUNNING, STOPPING } from '~/ide/stores/modules/terminal/constants'; -import { createStore } from '~/ide/stores'; -import eventHub from '~/ide/eventhub'; import { createTriggerUpdatePayload } from '../../helpers'; jest.mock('~/ide/lib/mirror'); diff --git a/spec/frontend/ide/stores/utils_spec.js b/spec/frontend/ide/stores/utils_spec.js index b185013050e..46a0794b2e6 100644 --- a/spec/frontend/ide/stores/utils_spec.js +++ b/spec/frontend/ide/stores/utils_spec.js @@ -1,5 +1,5 @@ -import * as utils from '~/ide/stores/utils'; import { commitActionTypes } from '~/ide/constants'; +import * as utils from '~/ide/stores/utils'; import { file } from '../helpers'; describe('Multi-file store utils', () => { |