Fork me on GitHub
#re-frame
<
2016-04-09
>
amacdougall19:04:18

I'm setting up unit tests for my handler functions, and I realized that I'm not sure how to test a handler which dispatches further events. Pure handlers are easy: they simply take the app db and return a changed one. Handlers with side effects are not too hard as long as I can with-redefs the side-effecting function and assert that it was called correctly (and test the real version somewhere else). But a handler which conditionally dispatches other events seems trickier. Maybe I should be using with-redefs on dispatch itself, and just assert that it's trying to dispatch the right event...? ...yeah, that's actually going to work. Thanks! :rubber_duck:

amacdougall19:04:39

(with-redefs [re-frame.core/dispatch (fn [[event-type & args]] ...)] ...)

leonfs21:04:39

does any one know what’s the best approach for i18n with reframe/reagent?