When testing the integration between a saga and a reducer, sometimes one needs to dispatch actions that affect the reducer in order to change the state in intermediate steps, but which the saga must completely ignore.
Such actions are being lost unless the saga takes them or puts them:
const {expectSaga} = require('redux-saga-test-plan')
function* a() {
yield 'I do not take any action, but the reducer should handle them anyway'
}
function reducer(state = 0, action) {
return action.value
}
expectSaga(a)
.withReducer(reducer)
.dispatch({type: 'A', value: 1})
.hasFinalState(1)
.run()
Outputs exception saying final state is undefined, when it should be 1.
Hi guys,
When testing the integration between a saga and a reducer, sometimes one needs to dispatch actions that affect the reducer in order to change the state in intermediate steps, but which the saga must completely ignore.
Such actions are being lost unless the saga takes them or puts them:
Outputs exception saying final state is
undefined
, when it should be1
.Thank you for your help.