Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Action creators vs actions in when clauses #8

Closed
tomvej opened this issue Apr 30, 2017 · 1 comment
Closed

Action creators vs actions in when clauses #8

tomvej opened this issue Apr 30, 2017 · 1 comment
Labels

Comments

@tomvej
Copy link
Contributor

tomvej commented Apr 30, 2017

Currently, when clauses contain actions. However, if there is an error in action creator (depends on how complex action creators you use), all tests fail. Since this library attempts at integration testing, we should probably include action creators. There are two syntax variants:

  • generator function: when('query is set', () => setQuery('Bridgeburners'));
  • spread: when('query is set', setQuery, 'Bridgeburners')
    The advantage of using generator function is you can apply several actions at once. The question is whether you should. If we agree on one action per when clause, spread syntax seems more natural.
@tomvej
Copy link
Contributor Author

tomvej commented May 18, 2017

I have decided for the spread operator since I like it a bit better (from redux-saga). There is even a way of applying multiple actions (use Array.isArray()).

@tomvej tomvej closed this as completed May 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant