diff options
Diffstat (limited to 'spec/frontend/boards/stores/mutations_spec.js')
-rw-r--r-- | spec/frontend/boards/stores/mutations_spec.js | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/spec/frontend/boards/stores/mutations_spec.js b/spec/frontend/boards/stores/mutations_spec.js index c5fe0e22c3c..2b6548534c3 100644 --- a/spec/frontend/boards/stores/mutations_spec.js +++ b/spec/frontend/boards/stores/mutations_spec.js @@ -1,7 +1,14 @@ import mutations from '~/boards/stores/mutations'; import * as types from '~/boards/stores/mutation_types'; import defaultState from '~/boards/stores/state'; -import { mockLists, rawIssue, mockIssue, mockIssue2, mockGroupProjects } from '../mock_data'; +import { + mockLists, + rawIssue, + mockIssue, + mockIssue2, + mockGroupProjects, + labels, +} from '../mock_data'; const expectNotImplemented = (action) => { it('is not implemented', () => { @@ -99,13 +106,11 @@ describe('Board Store Mutations', () => { }); }); - describe('RECEIVE_LABELS_FAILURE', () => { - it('sets error message', () => { - mutations.RECEIVE_LABELS_FAILURE(state); + describe('RECEIVE_LABELS_SUCCESS', () => { + it('sets labels on state', () => { + mutations.RECEIVE_LABELS_SUCCESS(state, labels); - expect(state.error).toEqual( - 'An error occurred while fetching labels. Please reload the page.', - ); + expect(state.labels).toEqual(labels); }); }); @@ -589,4 +594,27 @@ describe('Board Store Mutations', () => { expect(state.selectedProject).toEqual(mockGroupProjects[0]); }); }); + + describe('ADD_BOARD_ITEM_TO_SELECTION', () => { + it('Should add boardItem to selectedBoardItems state', () => { + expect(state.selectedBoardItems).toEqual([]); + + mutations[types.ADD_BOARD_ITEM_TO_SELECTION](state, mockIssue); + + expect(state.selectedBoardItems).toEqual([mockIssue]); + }); + }); + + describe('REMOVE_BOARD_ITEM_FROM_SELECTION', () => { + it('Should remove boardItem to selectedBoardItems state', () => { + state = { + ...state, + selectedBoardItems: [mockIssue], + }; + + mutations[types.REMOVE_BOARD_ITEM_FROM_SELECTION](state, mockIssue); + + expect(state.selectedBoardItems).toEqual([]); + }); + }); }); |