diff options
Diffstat (limited to 'spec/frontend/boards/stores/actions_spec.js')
-rw-r--r-- | spec/frontend/boards/stores/actions_spec.js | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index eacf9db191e..e48b946ff1b 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -77,7 +77,7 @@ describe('fetchBoard', () => { }, }; - it('should commit mutation RECEIVE_BOARD_SUCCESS and dispatch setBoardConfig on success', async () => { + it('should commit mutation REQUEST_CURRENT_BOARD and dispatch setBoard on success', async () => { jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); await testAction({ @@ -85,11 +85,10 @@ describe('fetchBoard', () => { payload, expectedMutations: [ { - type: types.RECEIVE_BOARD_SUCCESS, - payload: mockBoard, + type: types.REQUEST_CURRENT_BOARD, }, ], - expectedActions: [{ type: 'setBoardConfig', payload: mockBoard }], + expectedActions: [{ type: 'setBoard', payload: mockBoard }], }); }); @@ -101,6 +100,9 @@ describe('fetchBoard', () => { payload, expectedMutations: [ { + type: types.REQUEST_CURRENT_BOARD, + }, + { type: types.RECEIVE_BOARD_FAILURE, }, ], @@ -133,6 +135,20 @@ describe('setBoardConfig', () => { }); }); +describe('setBoard', () => { + it('dispatches setBoardConfig', () => { + return testAction({ + action: actions.setBoard, + payload: mockBoard, + expectedMutations: [{ type: types.RECEIVE_BOARD_SUCCESS, payload: mockBoard }], + expectedActions: [ + { type: 'setBoardConfig', payload: mockBoard }, + { type: 'performSearch', payload: { resetLists: true } }, + ], + }); + }); +}); + describe('setFilters', () => { it.each([ [ @@ -172,7 +188,11 @@ describe('performSearch', () => { {}, {}, [], - [{ type: 'setFilters', payload: {} }, { type: 'fetchLists' }, { type: 'resetIssues' }], + [ + { type: 'setFilters', payload: {} }, + { type: 'fetchLists', payload: { resetLists: false } }, + { type: 'resetIssues' }, + ], ); }); }); @@ -955,10 +975,6 @@ describe('fetchItemsForList', () => { state, [ { - type: types.RESET_ITEMS_FOR_LIST, - payload: listId, - }, - { type: types.REQUEST_ITEMS_FOR_LIST, payload: { listId, fetchNext: false }, }, @@ -980,10 +996,6 @@ describe('fetchItemsForList', () => { state, [ { - type: types.RESET_ITEMS_FOR_LIST, - payload: listId, - }, - { type: types.REQUEST_ITEMS_FOR_LIST, payload: { listId, fetchNext: false }, }, |