55 setPersistence ,
66 signInWithEmailAndPassword ,
77 signInWithPopup ,
8- signOut
8+ signOut ,
9+ sendEmailVerification
910} from 'firebase/auth'
1011
1112jest . mock ( 'firebase/auth' , ( ) => ( {
@@ -16,6 +17,7 @@ jest.mock('firebase/auth', () => ({
1617 signInWithPopup : jest . fn ( ) ,
1718 GoogleAuthProvider : jest . fn ( ) ,
1819 sendPasswordResetEmail : jest . fn ( ) ,
20+ sendEmailVerification : jest . fn ( ) ,
1921 setPersistence : jest . fn ( ) ,
2022 browserLocalPersistence : 'local' ,
2123 browserSessionPersistence : 'session'
@@ -40,6 +42,7 @@ describe('AuthController', () => {
4042
4143 beforeEach ( ( ) => {
4244 jest . clearAllMocks ( )
45+ sendEmailVerification . mockResolvedValue ( undefined )
4346 authController = new AuthController ( )
4447 } )
4548
@@ -69,7 +72,7 @@ describe('AuthController', () => {
6972
7073 describe ( 'signIn' , ( ) => {
7174 it ( 'should set local persistence when rememberMe is true' , async ( ) => {
72- const mockCredential = { user : { uid : 'user-id' } }
75+ const mockCredential = { user : { uid : 'user-id' , emailVerified : true } }
7376 setPersistence . mockResolvedValue ( )
7477 signInWithEmailAndPassword . mockResolvedValue ( mockCredential )
7578
@@ -85,7 +88,7 @@ describe('AuthController', () => {
8588
8689 it ( 'should set session persistence when rememberMe is false' , async ( ) => {
8790 setPersistence . mockResolvedValue ( )
88- signInWithEmailAndPassword . mockResolvedValue ( { user : { } } )
91+ signInWithEmailAndPassword . mockResolvedValue ( { user : { emailVerified : true } } )
8992
9093 await authController . signIn ( 'test@example.com' , 'password123' , false )
9194
0 commit comments