Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/helpers/vuex_action_helper_spec.js')
-rw-r--r--spec/javascripts/helpers/vuex_action_helper_spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/helpers/vuex_action_helper_spec.js b/spec/javascripts/helpers/vuex_action_helper_spec.js
index 8d6ad6750c0..09f0bd395c3 100644
--- a/spec/javascripts/helpers/vuex_action_helper_spec.js
+++ b/spec/javascripts/helpers/vuex_action_helper_spec.js
@@ -138,4 +138,29 @@ describe('VueX test helper (testAction)', () => {
});
});
});
+
+ it('should work with async actions not returning promises', done => {
+ const data = { FOO: 'BAR' };
+
+ const promiseAction = ({ commit, dispatch }) => {
+ dispatch('ACTION');
+
+ axios
+ .get(TEST_HOST)
+ .then(() => {
+ commit('SUCCESS');
+ return data;
+ })
+ .catch(error => {
+ commit('ERROR');
+ throw error;
+ });
+ };
+
+ mock.onGet(TEST_HOST).replyOnce(200, 42);
+
+ assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] };
+
+ testAction(promiseAction, null, {}, assertion.mutations, assertion.actions, done);
+ });
});