redux-reducer-test-plan
v1.0.1
Published
Test utility for redux reducers
Downloads
1
Readme
redux-reducer-test-plan
Easily test reducers by passing a state, action and expected result.
Install
yarn install redux-reducer-test-plan
Usage
To run the test just pass the reducer into the function and then set the state, action and expected result. Finally to execute the test call .run()
const TestReducer = require("redux-reducer-test-plan")
describe("Some test", () => {
it("some test case", () => {
TestReducer(reducer)
.state({ a: true })
.action({ type: "ACTION" })
.expect({ a: false })
.run()
})
})
.expect
can be a value or a function. If it is a function is calls the passing function with following values:
result
and prevState