Fork me on GitHub
#re-frame
<
2020-04-26
>
Alex05:04:48

I'm looking to write some unit tests on reagent view functions which leverage re-frame subscriptions within. Is the right approach to stub/mock the re-frame subscriptions?

beders18:05:01

what are you trying to achieve by testing view functions?

beders18:05:15

I've yet to find a good reason to do it. I'm truly curious. It's not a criticism

beders18:05:34

here's one approach I tried, but found too cumbersome: I split up the view code into two functions, the second function being called with data I gathered from subscriptions. That makes the view part pure and trivially testable. That said, visual inspection of the views, mixed in with Devcards seems to be sufficient