Skip to content

caiobalthazar/redux-test-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-test-store

Test existing stores in Redux, the easy way

Quick Start

  • npm install redux-test-store --save-dev
  • Import it:
import createTestStore from 'redux-test-store';

import store from '../path/to/real/store';

describe('auth action creators', () => {
  it('should authenticate successfully', (done) => {
    let tokenSet = [{token: 1}, {token: 2}];

    const testStore = createTestStore(store, done);

    testStore.when(actionTypes.CHANGE, (state, action) => {
      assert.deepEqual(state.auth.sets, tokenSet);
    });

    testStore.dispatch(actions.authenticate({
      email: '[email protected]',
      password: 'goat'
    }));
  });

About

Test existing stores in Redux, the easy way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%