diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-21 16:25:16 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-21 16:25:16 +0100 |
commit | 43240b9d5cd58839d7914ff72638146d5a561a97 (patch) | |
tree | 4849c19bc7456034b7968f486e77fb731b4ff460 /spec | |
parent | d5a24021a4e5839b3c7afabc50d46f4e12b8bbaf (diff) | |
download | gitlab-ce-43240b9d5cd58839d7914ff72638146d5a561a97.tar.gz |
Reinstate changes from MR 23234reinstate-d5a24021a4e583
This reinstates the changes added in MR
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23234. I was
testing a script that was supposed to operate on a fork of CE
(yorickpeterse/gitlab-ce), but it was operating on gitlab-org/gitlab-ce
by accident.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/ide/stores/actions/merge_request_spec.js | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/spec/javascripts/ide/stores/actions/merge_request_spec.js b/spec/javascripts/ide/stores/actions/merge_request_spec.js index 3a4e0d7507f..d8e9260e932 100644 --- a/spec/javascripts/ide/stores/actions/merge_request_spec.js +++ b/spec/javascripts/ide/stores/actions/merge_request_spec.js @@ -262,16 +262,28 @@ describe('IDE store merge request actions', () => { bar: {}, }; - spyOn(store, 'dispatch').and.callFake(type => { + const originalDispatch = store.dispatch; + + spyOn(store, 'dispatch').and.callFake((type, payload) => { switch (type) { case 'getMergeRequestData': return Promise.resolve(testMergeRequest); case 'getMergeRequestChanges': return Promise.resolve(testMergeRequestChanges); - default: + case 'getFiles': + case 'getMergeRequestVersions': + case 'getBranchData': + case 'setFileMrChange': return Promise.resolve(); + default: + return originalDispatch(type, payload); } }); + spyOn(service, 'getFileData').and.callFake(() => + Promise.resolve({ + headers: {}, + }), + ); }); it('dispatch actions for merge request data', done => { @@ -303,7 +315,17 @@ describe('IDE store merge request actions', () => { }); it('updates activity bar view and gets file data, if changes are found', done => { - testMergeRequestChanges.changes = [{ new_path: 'foo' }, { new_path: 'bar' }]; + store.state.entries.foo = { + url: 'test', + }; + store.state.entries.bar = { + url: 'test', + }; + + testMergeRequestChanges.changes = [ + { new_path: 'foo', path: 'foo' }, + { new_path: 'bar', path: 'bar' }, + ]; openMergeRequest(store, mr) .then(() => { @@ -321,8 +343,11 @@ describe('IDE store merge request actions', () => { 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); |