diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-04 18:06:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-04 18:06:38 +0300 |
commit | 5ecacec30458330df5fa6d591dc58e37afb41cd4 (patch) | |
tree | 58a9c004fdae78cbedbcc616dcfa783a1172eea3 /spec/javascripts/ide/stores/modules | |
parent | 0d46bf06388d485824bc2f1e736b92b2a8a397e4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/ide/stores/modules')
-rw-r--r-- | spec/javascripts/ide/stores/modules/commit/actions_spec.js | 92 |
1 files changed, 52 insertions, 40 deletions
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index ffb97c85326..95d927065f0 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -1,5 +1,5 @@ import rootActions from '~/ide/stores/actions'; -import store from '~/ide/stores'; +import { createStore } from '~/ide/stores'; import service from '~/ide/services'; import router from '~/ide/ide_router'; import eventHub from '~/ide/eventhub'; @@ -11,6 +11,7 @@ import { resetStore, file } from 'spec/ide/helpers'; import testAction from '../../../../helpers/vuex_action_helper'; const TEST_COMMIT_SHA = '123456789'; +const store = createStore(); describe('IDE commit module actions', () => { beforeEach(() => { @@ -59,7 +60,9 @@ describe('IDE commit module actions', () => { }); it('sets shouldCreateMR to true if "Create new MR" option is visible', done => { - store.state.shouldHideNewMrOption = false; + Object.assign(store.state, { + shouldHideNewMrOption: false, + }); testAction( actions.updateCommitAction, @@ -78,7 +81,9 @@ describe('IDE commit module actions', () => { }); it('sets shouldCreateMR to false if "Create new MR" option is hidden', done => { - store.state.shouldHideNewMrOption = true; + Object.assign(store.state, { + shouldHideNewMrOption: true, + }); testAction( actions.updateCommitAction, @@ -172,24 +177,31 @@ describe('IDE commit module actions', () => { content: 'file content', }); - store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; - store.state.projects.abcproject = { - web_url: 'web_url', - branches: { - master: { - workingReference: '', - commit: { - short_id: TEST_COMMIT_SHA, + Object.assign(store.state, { + currentProjectId: 'abcproject', + currentBranchId: 'master', + projects: { + abcproject: { + web_url: 'web_url', + branches: { + master: { + workingReference: '', + commit: { + short_id: TEST_COMMIT_SHA, + }, + }, }, }, }, - }; - store.state.stagedFiles.push(f, { - ...file('changedFile2'), - changed: true, + stagedFiles: [ + f, + { + ...file('changedFile2'), + changed: true, + }, + ], + openFiles: store.state.stagedFiles, }); - store.state.openFiles = store.state.stagedFiles; store.state.stagedFiles.forEach(stagedFile => { store.state.entries[stagedFile.path] = stagedFile; @@ -275,40 +287,40 @@ describe('IDE commit module actions', () => { document.body.innerHTML += '<div class="flash-container"></div>'; - store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; - store.state.projects.abcproject = { - web_url: 'webUrl', - branches: { - master: { - workingReference: '1', - commit: { - id: TEST_COMMIT_SHA, - }, - }, - }, - }; - const f = { ...file('changed'), type: 'blob', active: true, lastCommitSha: TEST_COMMIT_SHA, }; - store.state.stagedFiles.push(f); - store.state.changedFiles = [ - { - ...f, - }, - ]; - store.state.openFiles = store.state.changedFiles; - store.state.openFiles.forEach(localF => { - store.state.entries[localF.path] = localF; + Object.assign(store.state, { + stagedFiles: [f], + changedFiles: [f], + openFiles: [f], + currentProjectId: 'abcproject', + currentBranchId: 'master', + projects: { + abcproject: { + web_url: 'webUrl', + branches: { + master: { + workingReference: '1', + commit: { + id: TEST_COMMIT_SHA, + }, + }, + }, + }, + }, }); store.state.commit.commitAction = '2'; store.state.commit.commitMessage = 'testing 123'; + + store.state.openFiles.forEach(localF => { + store.state.entries[localF.path] = localF; + }); }); afterEach(() => { |