Skip to content

Commit e556a80

Browse files
committed
Action should receive only one payload (fix #402)
1 parent a462298 commit e556a80

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/en/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const actions = actionsInjector({
8686
})
8787

8888
// helper for testing action with expected mutations
89-
const testAction = (action, args, state, expectedMutations, done) => {
89+
const testAction = (action, payload, state, expectedMutations, done) => {
9090
let count = 0
9191

9292
// mock commit
@@ -103,7 +103,7 @@ const testAction = (action, args, state, expectedMutations, done) => {
103103
}
104104

105105
// call the action with mocked store and arguments
106-
action({ commit, state }, ...args)
106+
action({ commit, state }, payload)
107107

108108
// check if no mutations should have been dispatched
109109
if (expectedMutations.length === 0) {
@@ -114,7 +114,7 @@ const testAction = (action, args, state, expectedMutations, done) => {
114114

115115
describe('actions', () => {
116116
it('getAllProducts', done => {
117-
testAction(actions.getAllProducts, [], {}, [
117+
testAction(actions.getAllProducts, null, {}, [
118118
{ type: 'REQUEST_PRODUCTS' },
119119
{ type: 'RECEIVE_PRODUCTS', payload: { /* mocked response */ } }
120120
], done)

0 commit comments

Comments
 (0)