Hello there,
Thanks for the firebase bridge. We are trying to use the library and it works great, apart from the fact that the jest tests are breaking with the following error:
Invariant Violation: Native module cannot be null.
at invariant (node_modules/fbjs/lib/invariant.js:44:15)
at new NativeEventEmitter (node_modules/react-native/Libraries/EventEmitter/NativeEventEmitter.js:32:1)
at Object.<anonymous> (node_modules/react-native-firebase/lib/modules/base.js:10:23)
at Object.<anonymous> (node_modules/react-native-firebase/lib/modules/auth/index.js:5:11)
Any idea what can be done about it?
Hi.
I’m a user of this library and we got jest working by mocking the library.
You can see some patterns we’ve used with the library and the mock code here:
https://github.com/rmrs/react-native-redux-firebase-patterns.
The code in the patterns is explained in this post:
https://medium.com/rumors/react-native-redux-and-firebase-for-experts-by-dummies-6376becdd5c8
We’re currently using this mock internally.
I’ve posted a gist here with some examples:
https://gist.github.com/erezrokah/9faf04db358ec4bbcebb55580122120b
The way it works is by creating per path singletons of ref instances, so you have the same ref instance in you test code and tested code.
We might consider properly publishing it (with docs and all) if there is high demand for it.