This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-20
Channels
- # beginners (43)
- # boot (44)
- # chestnut (17)
- # cider (78)
- # cljs-dev (24)
- # cljsrn (16)
- # clojure (84)
- # clojure-dusseldorf (1)
- # clojure-italy (21)
- # clojure-losangeles (2)
- # clojure-russia (140)
- # clojure-sg (2)
- # clojure-spec (8)
- # clojure-uk (16)
- # clojurescript (23)
- # cursive (7)
- # datascript (1)
- # datomic (18)
- # docker (20)
- # ethereum (1)
- # fulcro (16)
- # garden (4)
- # graphql (27)
- # hoplon (9)
- # jobs (4)
- # luminus (34)
- # off-topic (6)
- # om (4)
- # onyx (35)
- # pedestal (3)
- # re-frame (24)
- # ring-swagger (15)
- # rum (6)
- # shadow-cljs (22)
- # spacemacs (8)
- # specter (22)
- # yada (7)
With re-frame & react native, how do I render a component so I can assert on it in a doo test? In tests I’m unable to require my-project.core because it requires cljs-exponent, which requires react-native, which fails because “DEV__ is not defined”. Google says this is a babel problem, not sure how to get past this. Once I pass that hurdle, not sure how to “shallow” render the component. CRNA apps use “react-test-renderer”. Reagent has a “render” method but it renders into a DOM element. Any suggestions? Thanks to @tiensonqin & @seantempesta for lein expo(nent) templates!
I’ve been using enzyme but only to do shallow renders, I think a better solution is to use: https://facebook.github.io/jest/docs/en/tutorial-react-native.html#snapshot-test
You’d probably want to convert your reagent components to react components using reactify-component
On a meta level I have found that component tests are less relevant when we have spec
+ re-frame
. It’s more important for us to unit test fns that handle business logic.
Thank you for the tips!
Any thoughts on how to require react-native/jest/setup
in a cljs.test, to get Jest’s RN mocks?
Currently getting “Unexpected token )” type errors because babel isn’t converting. I tried npm i [email protected]
and setting .babelrc to {"presets": ["react-native"]}
to no effect.
Maybe it’s because we’re using doo?
Yeah I used babel-register
to compile required files on the fly. Not very fast but ok for tests
So, do you guys do (js/JSON.stringify (clj->js {:some "map"}))
before sending a payload with js/fetch
or do you do something different?
And another question: Do you guys use react natives fetch or do you pull in some external library for it?
Thank you for the tips!
Any thoughts on how to require react-native/jest/setup
in a cljs.test, to get Jest’s RN mocks?
Currently getting “Unexpected token )” type errors because babel isn’t converting. I tried npm i [email protected]
and setting .babelrc to {"presets": ["react-native"]}
to no effect.
Maybe it’s because we’re using doo?