diff options
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' }; |