Open mfogel opened 6 years ago
@mfogel when mocking was recommended it was pre Detox days, now we'd 100% recommend using Detox to run your tests end to end (greybox testing) - you won't need to mock anything and it's as close to real world testing your app as you're gonna get.
Detox: wix/detox
If you're looking for an opinionated all-in-one starter kit with Detox baked in + RNFirebase then I'd recommend this one: ueno-llc/react-native-starter - it's great 👌
The goal of this starter kit was to be as raw and close to create-react-native-app
's output as possible without you having to fiddle with RNFirebase integrations - no opinions, no bloat etc.
Admittedly Detox integrated with this kit + CI would be awesome and should probably be part of this as standard - we'd love someone to PR this or start the ball rolling on this - will mark this issue as help wanted if anyone wants to pick this up.
For reference: our tests suite also uses Detox + Bridge over here: invertase/react-native-firebase/master/bridge
Here is a mock file for jest to mock react-native-firebase https://gist.github.com/chrchm/b437be0a8da3343d83e40e820bcfda11
After following the getting started instructions, running
npm test
results in an error:This has already been reported in the react-native-firebase repo and it appears this is expected behavior - according to that thread RNFirebase needs to be mocked out for the tests to work.
Assuming that's all correct, I would propose adding a basic mock for RNFirebase to this starter project and enabling it by default.