reduceActions
Testing helper. Calculates the state after dispatching an sequence of actions to a specific reducer, starting from the initial state.
Details
reduceActions
calls reducer
with each of the passed actions
- as if these had been dispatched in the specified order - and returns the resulting state. For the first reducer call, the reducer's initial state (as determined by getInitialState
) is used; each following call receives the state returned by the previous one.
If called without any actions, reduceActions
simply returns the reducer's initial state - that is, reduceActions(reducer)
is equivalent to getInitialState(reducer)
.
This helper is meant for use in reducer tests.
Examples
Basic usage:
Usage in a Jest test:
See Also
Testing guide
Last updated