Jest matchers for redux.
Homepage Repository npm Download
npm install @jest-matchers/redux@0.0.2
Jest matchers for redux.
npm install @jest-matchers/redux
yarn add @jest-matchers/redux
To get started with @jest-matchers/redux you need to import it before your tests are ran.
This can be done in a setupTestFrameworkScriptFile
or setupFiles
file.
setupTests.js
require("@jest-matchers/redux");
This function can be used to test whether an action has been dispatched by a (mock) store.
expect(store).toHaveDispatched("SOME_ACTION");
expect(store).toHaveDispatched({type: "SOME_ACTION"});
This function can be used to test whether an action has been dispatched by a (mock) store.
expect("SOME_ACTION").toHaveBeenDispatchedBy(store);
expect({type: "SOME_ACTION"}).toHaveBeenDispatchedBy(store);
This function can be used to test if an action is reduced correctly.
expect(mockStore).toReduceActionToState("SOME_ACTION", "SOME_STATE");
expect(mockStore).toReduceActionToState({type: "SOME_ACTION"}, "SOME_STATE");
Contributions in the form of pull requests and bug reports are appreciated.
Tests are ran using the test
npm script.
npm test
yarn test