Closed DrewSwitzer closed 4 years ago
Glad to hear someone is using the library and finds it useful.
I should have some time next week to add this in. Just a product of us not using the API yet in our of projects
👋 We addressed this in https://github.com/Upstatement/firestore-jest-mock/pull/11 @DrewSwitzer
For clarification, our where
function in this testing library doesn't actually filter out your mock database. There are too many variations and edge cases around it in firestore to recreate it here. This library instead returns your whole collection in the form of a querySnapshot and allows you to assert that you called where
correctly (i.e. testing your code and not firestore's).
Let me know if this helps!
I've been using firestore-jest-mock to mock all of my firestore functions for a project I'm currently working on and it's working great! I've run into one little snag, and that is the collectionGroup Firestore function has not been mocked yet.
What problem does this feature solve?
Include Firestore collectionGroup function as a mocked function.
The collectionGroup function documentation can be found at the following link:
Google API's Firestore
What does the proposed API look like?
There should not be any change to the way mockFirebase is used. If I create a mockFirebase database as seen in the following example:
mockFirebase should then mock function calls I am testing. In the following example I would expect the mocked functions to result in the function returning item objects 1, 2, and 3 from the above mockFirebase database example.