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__/vuex_action_helper_spec.js | |
parent | 14a32c2d551a646525b1fabd93cb70a0e6924478 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/__helpers__/vuex_action_helper_spec.js')
-rw-r--r-- | spec/frontend/__helpers__/vuex_action_helper_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
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' }; |