sbatson5 / firestore-jest-mock

Jest Helper library for mocking Cloud Firestore
https://www.npmjs.com/package/firestore-jest-mock
178 stars 59 forks source link

add options hash to mock #83

Closed sbatson5 closed 3 years ago

sbatson5 commented 3 years ago

Description

Adds the ability to pass options to the mock, allowing you to include id's in your document's data.

Related issues

Fixes: https://github.com/Upstatement/firestore-jest-mock/issues/68

Also adds the ability for future options, which I think can be a good stop-gap for https://github.com/Upstatement/firestore-jest-mock/pull/70

How to test

Pass a second param to mockFirebase as your "options." You can set includeIdsInData to have doc.data() return the id of the document (custom behavior).