/testing-cloud-firestore

Companion repository for the testing Cloud Firestore guide.

Primary LanguageTypeScript

Testing Cloud Firestore

Writing Cloud Firestore functions and security rules is relatively well documented and understood. Testing them, however, is not.

This repository is companion code to the following article.

Quick setup

yarn global add firebase-tools@7.3.0

cd server
yarn install
yarn lint && yarn validate

Running the tests

If you want to run the cloud function tests, you must set a local firebase project that corresponds to the project id found here

If you don't both use and specify an actual project id, cloud functions won't trigger in response to database writes. This tidbit slowed me down for the longest time, and I've confirmed it as expected behavior with firestore support.

yarn test