Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initializeApp does not return functions method #155

Open
crutchcorn opened this issue Sep 25, 2019 · 0 comments
Open

initializeApp does not return functions method #155

crutchcorn opened this issue Sep 25, 2019 · 0 comments

Comments

@crutchcorn
Copy link

The code usage I'm having looks like:

export const firebaseApp = firebase.initializeApp(firebaseConfig);
// Used for creating child accounts, primarily
export const firebaseSecondaryApp = firebase.initializeApp(firebaseConfig, 'Secondary');
export const firebaseAuth = firebaseApp.auth();
export const firebaseSecondaryAuth = firebaseSecondaryApp.auth();
export const firebaseDb = firebaseApp.database();
export const firebaseFunc = firebaseApp.functions();

With my mocks just looking like this:

jest.mock('firebase/auth', () => ({}));
jest.mock('firebase/functions', () => ({}));
jest.mock('firebase/database', () => ({}));
jest.mock('firebase/app', () => {
    const firebaseMock = require('firebase-mock');

    const mockDatabase = new firebaseMock.MockFirebase();
    const mockAuth = new firebaseMock.MockFirebase();
    const mockSDK = new firebaseMock.MockFirebaseSdk((path: any) => {
        return path ? mockDatabase.child(path) : mockDatabase;
    }, () => {
        return mockAuth;
    });

    const firebaseApp = mockSDK.initializeApp();

    return mockSDK;
});

However my code gives me errors as there is no functions method on the return value for initializeApp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant