sbatson5 / firestore-jest-mock

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

Cannot read property 'FirestoreAdminClient' of undefined #110

Open agordeev opened 3 years ago

agordeev commented 3 years ago

I added a function for backing up Firestore database, and now all my tests that use firestore-jest-mock fail due to this error:

    TypeError: Cannot read property 'FirestoreAdminClient' of undefined

      1 | import * as admin from 'firebase-admin'
      2 | import * as functions from 'firebase-functions'
    > 3 | const client = new admin.firestore.v1.FirestoreAdminClient()

The function uses admin.firestore.v1.FirestoreAdminClient type, which doesn't seem to exist in firestore-jest-mock. Any ideas how to fix this?

sbatson5 commented 3 years ago

Thanks for posting.

We don't currently have support for the v1 namespace (mostly because I've never used it). Do you know what major differences between the current firestore admin and the v1 are?

pureimpro commented 2 years ago

@agordeev have you found any solution ? this issue seems to be related : 1827

agordeev commented 2 years ago

@agordeev I stopped using firestore-jest-mock

rodneyrd commented 1 year ago

The fix in this comment 👉 https://github.com/firebase/firebase-admin-node/issues/1827#issuecomment-1290987649