You all did a great job with mocking two modules which are
firebase &
firebase-admin
KUDOS 👍 🏆
However, there is an assumption that the Auth module in the firebase module would be the same as the Auth module in firebase-admin but they are different i.e with different methods and properties
For more clarity:
This is the Auth module for Firebase Admin
This is the Auth module for Firebase
if you scroll to methods, you will see that the method list is different.
Steps to reproduce
Try to use the auth module from firebase-admin, e.g
import * as admin from 'firebase-admin';
admin.initializeApp();
const auth = admin.auth();
auth.createUser({ email: 'test@example.com', password: 'password', displayName: 'john doe' })
Expected result
Have createUser built-in as part of the FakeAuth class
OR
Create the flexibility to pass it in as a property in the overrides object
Actual result
TypeError: firebase_1.auth.createUser is not a function
Description
You all did a great job with mocking two modules which are
KUDOS 👍 🏆
However, there is an assumption that the Auth module in the firebase module would be the same as the Auth module in firebase-admin but they are different i.e with different methods and properties
For more clarity: This is the Auth module for Firebase Admin This is the Auth module for Firebase
if you scroll to methods, you will see that the method list is different.
Steps to reproduce
Try to use the
auth
module fromfirebase-admin
, e.gExpected result
createUser
built-in as part of theFakeAuth
class ORoverrides
objectActual result
TypeError: firebase_1.auth.createUser is not a function
Here is a link to a possible workaround solution https://gist.github.com/johnkingzy/9097b5b65fc8a472ed51a35d7a0aba45 TLDR: I redefined the
FakeAuth
class to match the module structure forfirebase-admin
Environment