Skip to content

Firebase-mock's firestore() function does not return a singleton #156

@Venryx

Description

@Venryx

The official require("firebase/app").firestore() function returns a singleton -- that is:

import firebase from "firebase/app";
firebase.initializeApp(/* ... */);
assert(firebase.firestore() === firebase.firestore()`); // always succeeds

However, the firebase-mock equivalent is inconsistent with that:

import {MockFirebaseSdk} from "firebase-mock";
const firebase = new MockFirebaseSdk();
assert(firebase.firestore() === firebase.firestore()); // always fails

To be consistent with the official firebase API, shouldn't additional calls to firestore() return the same singleton-value each time?

(This issue caused a lot of lost time in my project, as the configuration I made to one instance was mysteriously not being "seen" by another section of code, and it turned out to be due to the non-singleton behavior of the firebase-mock firestore() equivalent.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions