diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/issues/related_merge_requests/store/actions_spec.js | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/issues/related_merge_requests/store/actions_spec.js')
-rw-r--r-- | spec/frontend/issues/related_merge_requests/store/actions_spec.js | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/spec/frontend/issues/related_merge_requests/store/actions_spec.js b/spec/frontend/issues/related_merge_requests/store/actions_spec.js index 5f232fee09b..4327fac15d4 100644 --- a/spec/frontend/issues/related_merge_requests/store/actions_spec.js +++ b/spec/frontend/issues/related_merge_requests/store/actions_spec.js @@ -23,90 +23,82 @@ describe('RelatedMergeRequest store actions', () => { }); describe('setInitialState', () => { - it('commits types.SET_INITIAL_STATE with given props', (done) => { + it('commits types.SET_INITIAL_STATE with given props', () => { const props = { a: 1, b: 2 }; - testAction( + return testAction( actions.setInitialState, props, {}, [{ type: types.SET_INITIAL_STATE, payload: props }], [], - done, ); }); }); describe('requestData', () => { - it('commits types.REQUEST_DATA', (done) => { - testAction(actions.requestData, null, {}, [{ type: types.REQUEST_DATA }], [], done); + it('commits types.REQUEST_DATA', () => { + return testAction(actions.requestData, null, {}, [{ type: types.REQUEST_DATA }], []); }); }); describe('receiveDataSuccess', () => { - it('commits types.RECEIVE_DATA_SUCCESS with data', (done) => { + it('commits types.RECEIVE_DATA_SUCCESS with data', () => { const data = { a: 1, b: 2 }; - testAction( + return testAction( actions.receiveDataSuccess, data, {}, [{ type: types.RECEIVE_DATA_SUCCESS, payload: data }], [], - done, ); }); }); describe('receiveDataError', () => { - it('commits types.RECEIVE_DATA_ERROR', (done) => { - testAction( + it('commits types.RECEIVE_DATA_ERROR', () => { + return testAction( actions.receiveDataError, null, {}, [{ type: types.RECEIVE_DATA_ERROR }], [], - done, ); }); }); describe('fetchMergeRequests', () => { describe('for a successful request', () => { - it('should dispatch success action', (done) => { + it('should dispatch success action', () => { const data = { a: 1 }; mock.onGet(`${state.apiEndpoint}?per_page=100`).replyOnce(200, data, { 'x-total': 2 }); - testAction( + return testAction( actions.fetchMergeRequests, null, state, [], [{ type: 'requestData' }, { type: 'receiveDataSuccess', payload: { data, total: 2 } }], - done, ); }); }); describe('for a failing request', () => { - it('should dispatch error action', (done) => { + it('should dispatch error action', async () => { mock.onGet(`${state.apiEndpoint}?per_page=100`).replyOnce(400); - testAction( + await testAction( actions.fetchMergeRequests, null, state, [], [{ type: 'requestData' }, { type: 'receiveDataError' }], - () => { - expect(createFlash).toHaveBeenCalledTimes(1); - expect(createFlash).toHaveBeenCalledWith({ - message: expect.stringMatching('Something went wrong'), - }); - - done(); - }, ); + expect(createFlash).toHaveBeenCalledTimes(1); + expect(createFlash).toHaveBeenCalledWith({ + message: expect.stringMatching('Something went wrong'), + }); }); }); }); |