redux-mock-store-jest

0.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i redux-mock-store-jest

Weekly Downloads

43,594

Version

0.0.2

License

MIT

Last publish

Collaborators

  • sorrycc