0.0.2 • Published 8 years ago

redux-mock-store-jest v0.0.2

Weekly downloads
5,238
License
MIT
Repository
github
Last release
8 years ago

Circle CI

redux-mock-store

A mock store for your testing your redux async action creators and middleware

Install

npm install redux-mock-store --save-dev

How to use

// actions.test.js

import configureStore from 'redux-mock-store';

const middlewares = []; // add your middlewares like `redux-thunk`
const mockStore = configureStore(middlewares);

// Test in mocha
it('should dispatch action', (done) => {
  const getState = {}; // initial state of the store
  const action = { type: 'ADD_TODO' };
  const expectedActions = [action];

  const store = mockStore(getState, expectedActions, done);
  store.dispatch(action);
})

License

MIT