'FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app) - when using sinon
I have a NodeJS application and I'm trying to write some tests. Currently, I'm trying to stub Firebase. Current code:
sinon.stub(firebase, 'initializeApp');
const db = firebase.firestore();
const stub = sinon.stub(db, 'collection').returns({
  doc: sinon.stub().returns({
    set: sinon.stub().returns(null)
  })    
})
I'm trying to stub initializeApp but I'm getting:
FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
How do I stub initializeApp?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
