Fork me on GitHub
#cljsrn
<
2017-06-16
>
localshred16:06:31

I'm looking for some guidance on how to get a good testing story going. I am less interested in UI testing, more interested in just general unit testing of my re-frame event handlers and subscriptions. I've looked at re-frame-test and lein-doo, but neither of these projects has documentation specific to react-native. My guess is that either 1) no one is writing tests for rn, or 2) there are no fundamental differences to configure testing for re-natal as opposed to compiling for browser use. Can anyone give me some guidance on this, or resources I can use to learn more?

vikeri07:06:26

localshred: We’re using re-frame-test and doo. But had to do some custom things to get it to work for the RN code. But we run the tests in node which is nice

danielneal07:06:47

@U0AU4CPTN ooh I'm just about to start looking at doing exactly this, this morning - was it difficult to get working? What kinda custom stuff did you have to do

vikeri08:06:34

@U051H1KL1 re-frame-test works well, and unit tests in doo are very straightforward. The tricky part is mocking out js/require calls, for that we use https://github.com/mfncooper/mockery and https://github.com/RealOrangeOne/react-native-mock

danielneal08:06:26

ah cool thanks again for your tips!

localshred16:06:36

I used the setup from this project I found on github to get things going https://github.com/areina/elfeed-cljsrn/blob/master/project.clj

localshred16:06:17

but in the end ran into parser errors when I'd try to run the test commands (can't create ISeq from Keyword line 1 column 1 of the test file)