npm install
mocha
- Mocha for running tests
- Chai for assertions
- Sinon for stubs, spys, etc
- Nock to mock external API calls
- Rewire to mock
require
calls and to allow private method testing - Decache to help out with the Flux dispatcher being a singleton
- Use the React Test Utils
- Use Rewire's
__set__
method to mock nested React components. See - ParentTests.coffee for example.
- Use
dispatcher.dispatch
to dispatch fake actions - Use Rewire's
__get__
method to expose private methods - See ItemStoreTests.coffee for examples
- Use Sinon Spys and spy on
dispatcher.dispatch
to make sure your actions are firing as expected
- Use Nock to mock any external APIs that are needed in your tests