delphictech / expo-template

A React Native and Typescript mobile starter template, configured with the Expo workflow. πŸ“±
47 stars 7 forks source link

Added firebase functions as well as how to unit test these functions #27

Closed SethY8s closed 2 years ago

SethY8s commented 2 years ago

πŸ“‹ Initial Requirements

Please ensure that you have checked your PR for the following requirements:

  1. βœ… Compilation: You have run yarn tsc, checking for no typescript errors.
  2. βœ… Linting: You have run yarn lint and fixed all linting and formatting errors.
  3. βœ… Testing: You have rigorously tested your own code.
  4. βœ… Documentation: If needed, the documentation is updated with any relevant information or links to new resources.
  5. βœ… Developer Values: Code is modular, well-communicated, responsive, and as lightweight as possible.

πŸ”„ What was changed?


Initialized the firebase functions, to add a firebase function to the project. Also initialized the firebase emulators to help test these functions. Jest was used for unit testing and confirming that the function was working properly.

πŸ€” Why were these changes made?


Prior to these commits our stack had no unit testing. This is fine for small projects, however as Maet scales up we need better solutions, so we don't hit road blocks in the future due to code that is not tested.

βš™οΈ How to test:


  1. cd into the functions folder. If testing online deploy the function
  2. If deploying offline start both the firestore and functions emulator.
  3. in the terminal run "yarn test" this will run the unit test and it should come back green.

πŸ”— Useful resources/links: