diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-01 15:16:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-01 15:16:08 +0300 |
commit | c9439a09c51acff525f2e5c5cba8caecc270da8b (patch) | |
tree | cd344f3ce05525dccbc5f7d607d3fd1e76b46cd2 /spec/frontend/boards/stores/actions_spec.js | |
parent | 7bc1ee0bcb9cefaf788aa0b93383b7347e9010b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/stores/actions_spec.js')
-rw-r--r-- | spec/frontend/boards/stores/actions_spec.js | 90 |
1 files changed, 20 insertions, 70 deletions
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index e245325b956..f580469b072 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -1570,7 +1570,7 @@ describe('addListNewIssue', () => { describe('setActiveIssueLabels', () => { const state = { boardItems: { [mockIssue.id]: mockIssue } }; - const getters = { activeBoardItem: mockIssue }; + const getters = { activeBoardItem: { ...mockIssue, labels } }; const testLabelIds = labels.map((label) => label.id); const input = { labelIds: testLabelIds, @@ -1579,11 +1579,7 @@ describe('setActiveIssueLabels', () => { labels, }; - it('should assign labels on success', (done) => { - jest - .spyOn(gqlClient, 'mutate') - .mockResolvedValue({ data: { updateIssue: { issue: { labels: { nodes: labels } } } } }); - + it('should assign labels', () => { const payload = { itemId: getters.activeBoardItem.id, prop: 'labels', @@ -1601,74 +1597,28 @@ describe('setActiveIssueLabels', () => { }, ], [], - done, ); }); - it('throws error if fails', async () => { - jest - .spyOn(gqlClient, 'mutate') - .mockResolvedValue({ data: { updateIssue: { errors: ['failed mutation'] } } }); - - await expect(actions.setActiveIssueLabels({ getters }, input)).rejects.toThrow(Error); - }); - - describe('labels_widget FF on', () => { - beforeEach(() => { - window.gon = { - features: { labelsWidget: true }, - }; - - getters.activeBoardItem = { ...mockIssue, labels }; - }); - - afterEach(() => { - window.gon = { - features: {}, - }; - }); - - it('should assign labels', () => { - const payload = { - itemId: getters.activeBoardItem.id, - prop: 'labels', - value: labels, - }; - - testAction( - actions.setActiveIssueLabels, - input, - { ...state, ...getters }, - [ - { - type: types.UPDATE_BOARD_ITEM_BY_ID, - payload, - }, - ], - [], - ); - }); - - it('should remove label', () => { - const payload = { - itemId: getters.activeBoardItem.id, - prop: 'labels', - value: [labels[1]], - }; + it('should remove label', () => { + const payload = { + itemId: getters.activeBoardItem.id, + prop: 'labels', + value: [labels[1]], + }; - testAction( - actions.setActiveIssueLabels, - { ...input, removeLabelIds: [getIdFromGraphQLId(labels[0].id)] }, - { ...state, ...getters }, - [ - { - type: types.UPDATE_BOARD_ITEM_BY_ID, - payload, - }, - ], - [], - ); - }); + testAction( + actions.setActiveIssueLabels, + { ...input, removeLabelIds: [getIdFromGraphQLId(labels[0].id)] }, + { ...state, ...getters }, + [ + { + type: types.UPDATE_BOARD_ITEM_BY_ID, + payload, + }, + ], + [], + ); }); }); |