-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
Before you can start testing the functions
, you'll need to create a test Firebase project using the Firebase Setup instructions. This test project will be used within the test suite to avoid messing the production data. Follow these instructions to create a service account and save the file as serviceAccountKey.relar-test.json
in the root of the repository.
Eventually, once there is a storage emulator (see this issue), we won't need a test project.
Next, you will need to create a local .runtimeconfig.json
file with the firebase functions config. This .runtimeconfig.json
file is loaded during testing automatically (more information here) since function config is not loaded.
# in functions/
firebase functions:config:get --project <PROJECT_ID> > .runtimeconfig.json
Make sure to use the project ID from your real firebase project and not your test project.
Both the app
and functions
directories have their own test suite that uses esbuild-register
and uvu
to run the tests. In either of the directories, you can now run the test
command to kick off the test suite.
# in functions/ or app/
npm run test