diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/frontend/task_list_spec.js | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/frontend/task_list_spec.js')
-rw-r--r-- | spec/frontend/task_list_spec.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/frontend/task_list_spec.js b/spec/frontend/task_list_spec.js index 2d7a735bd11..bf470e7e126 100644 --- a/spec/frontend/task_list_spec.js +++ b/spec/frontend/task_list_spec.js @@ -125,6 +125,7 @@ describe('TaskList', () => { const response = { data: { lock_version: 3 } }; jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {}); jest.spyOn(taskList, 'disableTaskListItems').mockImplementation(() => {}); + jest.spyOn(taskList, 'onUpdate').mockImplementation(() => {}); jest.spyOn(taskList, 'onSuccess').mockImplementation(() => {}); jest.spyOn(axios, 'patch').mockReturnValue(Promise.resolve(response)); @@ -151,8 +152,11 @@ describe('TaskList', () => { }, }; - taskList - .update(event) + const update = taskList.update(event); + + expect(taskList.onUpdate).toHaveBeenCalled(); + + update .then(() => { expect(taskList.disableTaskListItems).toHaveBeenCalledWith(event); expect(axios.patch).toHaveBeenCalledWith(endpoint, patchData); @@ -168,12 +172,17 @@ describe('TaskList', () => { it('should handle request error and enable task list items', (done) => { const response = { data: { error: 1 } }; jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {}); + jest.spyOn(taskList, 'onUpdate').mockImplementation(() => {}); jest.spyOn(taskList, 'onError').mockImplementation(() => {}); jest.spyOn(axios, 'patch').mockReturnValue(Promise.reject({ response })); // eslint-disable-line prefer-promise-reject-errors const event = { detail: {} }; - taskList - .update(event) + + const update = taskList.update(event); + + expect(taskList.onUpdate).toHaveBeenCalled(); + + update .then(() => { expect(taskList.enableTaskListItems).toHaveBeenCalledWith(event); expect(taskList.onError).toHaveBeenCalledWith(response.data); |