diff options
author | Phil Hughes <me@iamphill.com> | 2018-05-30 11:10:32 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-05-30 11:10:32 +0100 |
commit | 3bffbb159eebf80dabfa2476a040a620e051be0b (patch) | |
tree | 5e300e5c4ebeceb72e06cc971d61f4a69ac26dfc /spec/javascripts | |
parent | 8f646faf3dc2ded677a9a5fbca16b5da9b146d19 (diff) | |
download | gitlab-ce-3bffbb159eebf80dabfa2476a040a620e051be0b.tar.gz |
ability to search merge requests
reset merge requests before fetch
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js | 30 |
1 files changed, 27 insertions, 3 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 3b88ac36683..b571cfb963a 100644 --- a/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js @@ -12,7 +12,7 @@ import actions, { import { mergeRequests } from '../../../mock_data'; import testAction from '../../../../helpers/vuex_action_helper'; -describe('IDe merge requests actions', () => { +describe('IDE merge requests actions', () => { let mockedState; let mock; @@ -95,6 +95,21 @@ describe('IDe merge requests actions', () => { params: { scope: 'assigned-to-me', state: 'opened', + search: '', + }, + }); + }); + + it('calls API with search', () => { + const apiSpy = spyOn(axios, 'get').and.callThrough(); + + fetchMergeRequests({ dispatch() {}, state: mockedState }, 'testing search'); + + expect(apiSpy).toHaveBeenCalledWith(jasmine.anything(), { + params: { + scope: 'assigned-to-me', + state: 'opened', + search: 'testing search', }, }); }); @@ -105,7 +120,11 @@ describe('IDe merge requests actions', () => { null, mockedState, [], - [{ type: 'requestMergeRequests' }, { type: 'receiveMergeRequestsSuccess' }], + [ + { type: 'requestMergeRequests' }, + { type: 'resetMergeRequests' }, + { type: 'receiveMergeRequestsSuccess' }, + ], done, ); }); @@ -118,6 +137,7 @@ describe('IDe merge requests actions', () => { [], [ { type: 'requestMergeRequests' }, + { type: 'resetMergeRequests' }, { type: 'receiveMergeRequestsSuccess', payload: mergeRequests }, ], done, @@ -136,7 +156,11 @@ describe('IDe merge requests actions', () => { null, mockedState, [], - [{ type: 'requestMergeRequests' }, { type: 'receiveMergeRequestsError' }], + [ + { type: 'requestMergeRequests' }, + { type: 'resetMergeRequests' }, + { type: 'receiveMergeRequestsError' }, + ], done, ); }); |