0.4.0 • Published 9 years ago

marty-test-utils v0.4.0

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

marty-test-utils

A bunch of helpers to aid marty testing.

Build Status

mockStore

Use it to fake a Store.

mockStore('MyStore', {
  method1: spy()
});

mockComponent

Use it to fake a React component.

mockComponent('Test'); // => <div></div>
mockComponent('Test', 'span'); // => <span></span>

onDispatchedAction

Use it to test actions triggered through a dispatcher inside ActionCreators and Queries.

const dispatcher = Marty.dispatcher.getDefault();

it('tests a dispatched action', (done) => {
  onDispatchedAction(dispatcher, wcheck(done, (payload) => {
    assert(true); // <-- here go your tests
  }));

  ActionCreators.doSomething();
});

onStoreChange

Use it to test Store changes after the actions were handled.

const dispatcher = Marty.dispatcher.getDefault();

it('tests a store change', (done) => {
  onStoreChange(Store, wcheck(done, (state) => {
    assert(true); // <-- here go your tests
  }));

  // Fake the dispatcher emitting an action
  dispatcher.dispatchAction({type: Mock.Constants.USER_SET_EMAIL, arguments: [EMAIL]});
});

MIT license.

0.4.0

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago