Is there a way to run firestore locally (e.g. for testing purposes)?
What would the approach to write tests against the DB (except of using mocks)
Firestore can be setup in local using gcloud
.
Start the firestore emulator by running gcloud beta emulators firestore start --host-port=localhost:8081
and if it started successfully you will be seeing Dev App Server is now running
In case if you are using @google-cloud/firestore
then create the Firestore instance in this way
// Firestore instance only for test env
const { Firestore } = require('@google-cloud/firestore')
const instance = new Firestore({ projectId; 'Your project id', host: 'localhost', 'port': 8081})