Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 23, 2023 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/a0ff0997bbb08d7241549512378abff3 to your computer and use it in GitHub Desktop.
Save YonatanKra/a0ff0997bbb08d7241549512378abff3 to your computer and use it in GitHub Desktop.
Tauri-demo: test login method with firebase auth
it('should toggle `isLoggedIn` if login successful', async () => {
const firebaseAuth = await import('firebase/auth');
(firebaseAuth.signInWithEmailAndPassword as any).mockImplementation(async () => {
const user = {
uid: '123',
email: 'test@test.com'
};
(firebaseAuth.getAuth as any).mockReturnValue({
currentUser: user
});
return {
user
}
});
await auth.login();
expect(auth.isLoggedIn()).toBe(true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment