wix-incubator / redux-testkit

Complete and opinionated testkit for testing Redux projects (reducers, selectors, actions, thunks)
MIT License
227 stars 20 forks source link

Chaining multiple actions on a reducer #12

Open brettjonesdev opened 7 years ago

brettjonesdev commented 7 years ago

Is there any way to do something like this:

const resultingState = Reducer(reducer).execute(actionOne, actionTwo, actionThree)

I basically want to run a series of actions against a state/reducer and make assertions about the result. Is there a way to do this right now? The only way I seem to be able to achieve this is a kind of unwieldy:

const red = Reducer(reducer)
const resultingState = red.withState(
  red.withState(red.execute(actionOne)).execute(actionTwo))
  .execute(actionThree)

Would be great if there were a built-in way to chain actions?