Closed FrozenKiwi closed 4 years ago
I tried copying in the actual test from firestore-jest-mock
and this had the same failures.
My setup may be a bit unusual because my monorepo connects to firestore from GoogleApps, website, & node (so there are a few different firestore apps, and a project disambiguates them to allow library code to be agnostic of the environment). If that is somehow relevant?
For my case, I simply skipped mocking the firestore module (as I don't/cant directly use it anyway) and just instantiated FakeFirestore directly.
import { SetFirestore } from './firestore';
import { Timestamp } from './timestamp';
const mocks = require('firestore-jest-mock');
export async function init(database: object) {
// Import the mocked db, and assign.
Timestamp.init(mocks.FakeFirestore.Timestamp);
SetFirestore(new mocks.FakeFirestore(database));
}
Ps. This project is a great find! Thanks so much!
Description
Queries return 0 docs
Steps to reproduce
The following minimal example is built from help docs & tests in this repo:
Expected result
test should pass
Actual result
Fails with recieved: 0, expected 2.
Environment