From 1482bacb55214bca44e4456f99c2c13f9adde6d4 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 9 Nov 2017 14:20:19 -0800 Subject: [PATCH] Provide action to subscribed functions. --- src/index.js | 2 +- test/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 56c523f..9c7b9d1 100644 --- a/src/index.js +++ b/src/index.js @@ -38,7 +38,7 @@ export default function configureStore (middlewares = []) { actions.push(action) for (let i = 0; i < listeners.length; i++) { - listeners[i]() + listeners[i](action) } return action diff --git a/test/index.js b/test/index.js index 2e60747..4e616ce 100644 --- a/test/index.js +++ b/test/index.js @@ -108,8 +108,9 @@ describe('redux-mock-store', () => { const store = mockStore() const action = { type: 'ADD_ITEM' } - store.subscribe(() => { + store.subscribe((a) => { expect(store.getActions()[0]).toEqual(action) + expect(action).toEqual(a) done() }) store.dispatch(action)