diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-03 18:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-03 18:08:43 +0300 |
commit | dbe0e5676267eb142dd8d81e4c881c997cb96962 (patch) | |
tree | 765b50588c3c1540297dc6a76eea1122dd59cdac /spec/frontend/__helpers__ | |
parent | 14a32c2d551a646525b1fabd93cb70a0e6924478 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/__helpers__')
-rw-r--r-- | spec/frontend/__helpers__/vuex_action_helper.js | 2 | ||||
-rw-r--r-- | spec/frontend/__helpers__/vuex_action_helper_spec.js | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/frontend/__helpers__/vuex_action_helper.js b/spec/frontend/__helpers__/vuex_action_helper.js index bdd5a0a9034..94164814879 100644 --- a/spec/frontend/__helpers__/vuex_action_helper.js +++ b/spec/frontend/__helpers__/vuex_action_helper.js @@ -78,6 +78,8 @@ export default ( } actions.push(dispatchedAction); + + return Promise.resolve(); }; const validateResults = () => { diff --git a/spec/frontend/__helpers__/vuex_action_helper_spec.js b/spec/frontend/__helpers__/vuex_action_helper_spec.js index 4bd21ff150a..64081ca11a3 100644 --- a/spec/frontend/__helpers__/vuex_action_helper_spec.js +++ b/spec/frontend/__helpers__/vuex_action_helper_spec.js @@ -83,6 +83,20 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( }); }); + describe('given an async action (chaining off a dispatch)', () => { + it('mocks dispatch accurately', () => { + const asyncAction = ({ commit, dispatch }) => { + return dispatch('ACTION').then(() => { + commit('MUTATION'); + }); + }; + + assertion = { actions: [{ type: 'ACTION' }], mutations: [{ type: 'MUTATION' }] }; + + return testAction(asyncAction, null, {}, assertion.mutations, assertion.actions); + }); + }); + describe('given an async action (returning a promise)', () => { const data = { FOO: 'BAR' }; |