@@ -104,10 +104,13 @@ vi.mock("./country-selector", () => ({
104104describe ( "<PhoneAuthForm />" , ( ) => {
105105 beforeEach ( ( ) => {
106106 vi . clearAllMocks ( ) ;
107+ vi . useFakeTimers ( { shouldAdvanceTime : true } ) ;
107108 } ) ;
108109
109110 afterEach ( ( ) => {
111+ vi . runOnlyPendingTimers ( ) ;
110112 cleanup ( ) ;
113+ vi . useRealTimers ( ) ;
111114 } ) ;
112115
113116 it ( "should render the phone number form initially" , ( ) => {
@@ -201,7 +204,6 @@ describe("<PhoneAuthForm />", () => {
201204 </ FirebaseUIProvider >
202205 ) ;
203206
204- // Initially should show phone number form
205207 expect ( container . querySelector ( "input[name='phoneNumber']" ) ) . toBeInTheDocument ( ) ;
206208
207209 const phoneInput = container . querySelector ( "input[name='phoneNumber']" ) ! ;
@@ -219,12 +221,10 @@ describe("<PhoneAuthForm />", () => {
219221 expect ( mockAction ) . toHaveBeenCalled ( ) ;
220222 } ) ;
221223
222- // Wait for verification form to appear
223224 await waitFor ( ( ) => {
224225 expect ( container . querySelector ( "input[name='verificationCode']" ) ) . toBeInTheDocument ( ) ;
225226 } ) ;
226227
227- // Check for description
228228 const description = container . querySelector ( '[data-slot="form-description"]' ) ;
229229 expect ( description ) . toBeInTheDocument ( ) ;
230230 expect ( description ) . toHaveTextContent ( "Enter the verification code sent to your phone number" ) ;
@@ -390,7 +390,7 @@ describe("<PhoneAuthForm />", () => {
390390 phoneNumber : "Phone Number" ,
391391 } ,
392392 errors : {
393- "auth/invalid-phone-number" : "Error: Invalid phone number format" ,
393+ invalidPhoneNumber : "Error: Invalid phone number format" ,
394394 } ,
395395 } ) ,
396396 } ) ;
0 commit comments