guides/Generating Jest Mocks.md
This document will guide you through the process of generating new Jest Mocks for packages/jest-expo module using apps/jest-expo-mock-generator.
We provide some mocks of our native methods which are generated by traversing all the modules and its methods and making a configuration of all those methods with the number of arguments etc.
apps/jest-expo-mock-generatoryarn to ensure the dependencies are installedexpo start to start the Expo serveriOS by opening ios/Exponent.xcworkspaceOpen jest-expo-mock-generator in the running Expo Go app
After the app is finished opening, in the terminal, where the Expo server is running, you should see a big chunk of text wrapped with
------------------------------COPY THE TEXT BELOW------------------------------
and
------------------------------END OF TEXT TO COPY------------------------------
lines. Select and copy the text from between those lines.
https://user-images.githubusercontent.com/379606/120577838-b4964a80-c3d9-11eb-93db-aba3ea9eef41.mp4
Stop the Expo server running in apps/jest-expo-mock-generator, started in step 1.
Paste the copied text into packages/jest-expo/src/preset/expoModules.js.
In the terminal, go into packages/jest-expo.
Run yarn prettier src/preset/expoModules.js --write.
Commit the changes. Bonus points for not modifying mock values (like deviceYearClass), which will be different if you use a test device different than the one used before.