diff options
author | Phil Hughes <me@iamphill.com> | 2018-06-11 12:08:30 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-06-11 12:08:30 +0100 |
commit | d5dae8e59a4097cb5f5be7405c793333683a2317 (patch) | |
tree | ba0b0ba9fe5930b548cee402c29e729f87e586dc /spec | |
parent | 7469b58eafb2658542211479cd2e615203f94248 (diff) | |
download | gitlab-ce-d5dae8e59a4097cb5f5be7405c793333683a2317.tar.gz |
fixed specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js b/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js index d178a44b76a..03ec08d05c3 100644 --- a/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js @@ -199,28 +199,39 @@ describe('IDE merge requests actions', () => { }); it('commits reset mutations and actions', done => { - testAction( - openMergeRequest, - { projectPath: 'gitlab-org/gitlab-ce', id: '1' }, - mockedState, - [ - { type: 'CLEAR_PROJECTS' }, - { type: 'SET_CURRENT_MERGE_REQUEST', payload: '1' }, - { type: 'RESET_OPEN_FILES' }, - ], - [ - { type: 'pipelines/stopPipelinePolling' }, - { type: 'pipelines/clearEtagPoll' }, - { type: 'pipelines/resetLatestPipeline' }, - { type: 'setCurrentBranchId', payload: '' }, - ], - done, - ); + const commit = jasmine.createSpy(); + const dispatch = jasmine.createSpy().and.returnValue(Promise.resolve()); + openMergeRequest({ commit, dispatch }, { projectPath: 'gitlab-org/gitlab-ce', id: '1' }); + + setTimeout(() => { + expect(commit.calls.argsFor(0)).toEqual(['CLEAR_PROJECTS', null, { root: true }]); + expect(commit.calls.argsFor(1)).toEqual(['SET_CURRENT_MERGE_REQUEST', '1', { root: true }]); + expect(commit.calls.argsFor(2)).toEqual(['RESET_OPEN_FILES', null, { root: true }]); + + expect(dispatch.calls.argsFor(0)).toEqual([ + 'pipelines/resetLatestPipeline', + null, + { root: true }, + ]); + expect(dispatch.calls.argsFor(1)).toEqual(['setCurrentBranchId', '', { root: true }]); + expect(dispatch.calls.argsFor(2)).toEqual([ + 'pipelines/stopPipelinePolling', + null, + { root: true }, + ]); + expect(dispatch.calls.argsFor(3)).toEqual([ + 'pipelines/clearEtagPoll', + null, + { root: true }, + ]); + + done(); + }); }); it('pushes new route', () => { openMergeRequest( - { commit() {}, dispatch() {} }, + { commit() {}, dispatch: () => Promise.resolve() }, { projectPath: 'gitlab-org/gitlab-ce', id: '1' }, ); |