Created
September 23, 2023 18:41
-
-
Save YonatanKra/a0ff0997bbb08d7241549512378abff3 to your computer and use it in GitHub Desktop.
Tauri-demo: test login method with firebase auth
This file contains 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
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