Last active
September 23, 2023 02:22
-
-
Save YonatanKra/24de4634364b3a2e3eb0f887ec9007ed to your computer and use it in GitHub Desktop.
Tauri-demo: firebase app init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Firebase } from './firebase'; | |
describe('firebase', () => { | |
let firebase: Firebase; | |
beforeAll(() => { | |
vi.mock('firebase/app', () => { | |
return { | |
initializeApp: () => 'MockFirebaseApp' | |
} | |
}); | |
customElements.define('yag-firebase', Firebase); | |
}); | |
afterAll(() => { | |
vi.restoreAllMocks(); | |
}); | |
beforeEach(() => { | |
firebase = document.createElement('yag-firebase') as Firebase; | |
}); | |
describe('init', () => { | |
it('should expose an app property', () => { | |
expect(firebase).toBeTruthy(); | |
expect(firebase.app).toBe('MockFirebaseApp'); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FirebaseApp, initializeApp } from "firebase/app"; | |
const firebaseConfig = { | |
apiKey: "***REMOVED***", | |
authDomain: "***REMOVED***.firebaseapp.com", | |
projectId: "***REMOVED***", | |
storageBucket: "***REMOVED***.appspot.com", | |
messagingSenderId: "***REMOVED***", | |
appId: "***REMOVED***" | |
}; | |
export const app = initializeApp(firebaseConfig); | |
export class Firebase extends HTMLElement { | |
app: FirebaseApp = app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment