Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
🐛 Propagates return in action
Browse files Browse the repository at this point in the history
Closes #68

Signed-off-by: Eduardo San Martin Morote <[email protected]>
  • Loading branch information
posva committed May 10, 2017
1 parent 70f426c commit ace641f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ export function firebaseAction (action) {
bind({ state, commit, key, source, options })
context.unbindFirebaseRef = (key) =>
unbind({ commit, key })
action(context, payload)
return action(context, payload)
}
}
28 changes: 28 additions & 0 deletions test/store.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import test from 'ava'
import Vue from 'vue'
import Vuex from 'vuex'

import {
firebaseMutations,
firebaseAction,
} from '../src'

test.before(t => {
Vue.use(Vuex)
})

test.beforeEach(t => {
t.context.store = new Vuex.Store({
state: {
options: null,
},
actions: {
give: firebaseAction(() => true),
},
mutations: firebaseMutations,
})
})

test('propagates the returns', async (t) => {
t.is(await t.context.store.dispatch('give'), true)
})

0 comments on commit ace641f

Please sign in to comment.