Please use Prettier to format the code.
Before running unit tests for the first time, you need to download the Firestore emulator by running the command:
make test-setup
To run the tests:
# Run tests once
make test
# Run tests in the watch mode
make test-watch
Typesaurus React system tests connect to a real database, so to run them, you need to prepare a Firebase project and point the suite to the project. See How to set up tests? for more details.
To run the tests:
# Run system tests:
make test-system
# Run system tests in the watch mode:
make test-system-watch
-
First of all, create a Firebase project and enable Firestore.
-
Set the project ID and web API key to
FIREBASE_PROJECT_ID
andFIREBASE_API_KEY
respectively. -
You also might want to create a user with a password (set email to
FIREBASE_USERNAME
and password toFIREBASE_PASSWORD
) and set your rules to allow writes and reads only to this user:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid == "xxx";
}
}
}
However, this step is optional and should not be a concern unless you make your web API key public.