@@ -523,57 +523,4 @@ describe('SignUpStart', () => {
523523 await waitFor ( ( ) => screen . getByText ( / c r e a t e y o u r a c c o u n t / i) ) ;
524524 } ) ;
525525 } ) ;
526-
527- describe ( 'unsafeMetadata' , ( ) => {
528- it ( 'does not throw when signUp.create rejects with an API error' , async ( ) => {
529- Object . defineProperty ( window , 'location' , {
530- writable : true ,
531- value : { href : 'http://localhost/sign-up' } ,
532- } ) ;
533-
534- let unhandledError : unknown = null ;
535- const onUnhandledRejection = ( reason : unknown ) => {
536- unhandledError = reason ;
537- } ;
538- process . on ( 'unhandledRejection' , onUnhandledRejection ) ;
539-
540- const { wrapper, fixtures, props } = await createFixtures ( f => {
541- f . withEmailAddress ( { required : true } ) ;
542- f . withPassword ( { required : true } ) ;
543- } ) ;
544- fixtures . signUp . create . mockRejectedValueOnce (
545- new ClerkAPIResponseError ( 'Error' , {
546- data : [
547- {
548- code : 'form_password_pwned' ,
549- long_message : 'Password has been found in an online data breach.' ,
550- message : 'Password has been found in an online data breach.' ,
551- meta : { param_name : 'password' } ,
552- } ,
553- ] ,
554- status : 422 ,
555- } ) ,
556- ) ;
557- props . setProps ( { unsafeMetadata : { foo : 'bar' } } ) ;
558-
559- const { userEvent } = render (
560- < CardStateProvider >
561- < SignUpStart />
562- </ CardStateProvider > ,
563- { wrapper } ,
564- ) ;
565-
566- await userEvent . type ( screen . getByLabelText ( / e m a i l a d d r e s s / i) , 'test@example.com' ) ;
567- await userEvent . type ( screen . getByPlaceholderText ( / c r e a t e a p a s s w o r d / i) , 'password123' ) ;
568- await userEvent . click ( screen . getByText ( / c o n t i n u e / i) ) ;
569-
570- await waitFor ( ( ) => expect ( fixtures . signUp . create ) . toHaveBeenCalled ( ) ) ;
571- await screen . findByTestId ( 'form-feedback-error' ) ;
572- // Flush pending microtasks so any unhandled rejection event has a chance to fire.
573- await new Promise ( resolve => setTimeout ( resolve , 0 ) ) ;
574-
575- process . off ( 'unhandledRejection' , onUnhandledRejection ) ;
576- expect ( unhandledError ) . toBeNull ( ) ;
577- } , 15_000 ) ;
578- } ) ;
579526} ) ;
0 commit comments