Module Creation

Modules

First thing you need to do in your module, for example react-native-navigation is to add mocks to all imports from the module which you want to test, you can do it using jest mock like it is done here react-native-navigation.


Creating a mock class

Then when you are creating a class, for example React Native Navigation Module you do need to initialize screen object in which you will record all the arguments with which mock implementations of your methods were called screenObj. Then you will create a void implementation of your methods, but don't forget also to add a record to your screen object of parameters with which your methods were called .


Actions Generator

Action generator give you few methods that extends your driver, for example for React Native Navigation Module you will have few additional methods tap, inspectScreen, closeScreen.


Collecting effects

The collecting effects method will be called at the end of every test and will provide you an array of log items for your methods calls. At first you need to specify your own key for using in collectEffects methods keyExample, then you will need to implement collectEffects method, and it can be implemented differently depending on a module that you are testing. Here we have an examples for react-native-navigation, fetch.


Clearing

Please don't forget to clear your screen object at the end of the collect effects method.