@@ -679,6 +679,59 @@ describe('SignInStart', () => {
679679 ) ;
680680 } ) ;
681681 } ) ;
682+
683+ it ( 'does not pass signUpIfMissing when sign-up mode is restricted' , async ( ) => {
684+ const { wrapper, fixtures, props } = await createFixtures ( f => {
685+ f . withEmailAddress ( ) ;
686+ f . withEnumerationProtection ( ) ;
687+ f . withRestrictedMode ( ) ;
688+ } ) ;
689+ props . setProps ( { withSignUp : true } ) ;
690+ fixtures . signIn . create . mockReturnValueOnce ( Promise . resolve ( { status : 'needs_first_factor' } as SignInResource ) ) ;
691+ const { userEvent } = render ( < SignInStart /> , { wrapper } ) ;
692+ await userEvent . type ( screen . getByLabelText ( / e m a i l a d d r e s s / i) , 'hello@clerk.com' ) ;
693+ await userEvent . click ( screen . getByText ( 'Continue' ) ) ;
694+ expect ( fixtures . signIn . create ) . toHaveBeenCalledWith (
695+ expect . not . objectContaining ( {
696+ signUpIfMissing : true ,
697+ } ) ,
698+ ) ;
699+ } ) ;
700+
701+ it ( 'does not pass signUpIfMissing when sign-up mode is waitlist' , async ( ) => {
702+ const { wrapper, fixtures, props } = await createFixtures ( f => {
703+ f . withEmailAddress ( ) ;
704+ f . withEnumerationProtection ( ) ;
705+ f . withWaitlistMode ( ) ;
706+ } ) ;
707+ props . setProps ( { withSignUp : true } ) ;
708+ fixtures . signIn . create . mockReturnValueOnce ( Promise . resolve ( { status : 'needs_first_factor' } as SignInResource ) ) ;
709+ const { userEvent } = render ( < SignInStart /> , { wrapper } ) ;
710+ await userEvent . type ( screen . getByLabelText ( / e m a i l a d d r e s s / i) , 'hello@clerk.com' ) ;
711+ await userEvent . click ( screen . getByText ( 'Continue' ) ) ;
712+ expect ( fixtures . signIn . create ) . toHaveBeenCalledWith (
713+ expect . not . objectContaining ( {
714+ signUpIfMissing : true ,
715+ } ) ,
716+ ) ;
717+ } ) ;
718+
719+ it ( 'does not pass signUpIfMissing when the identifier is a username' , async ( ) => {
720+ const { wrapper, fixtures, props } = await createFixtures ( f => {
721+ f . withUsername ( ) ;
722+ f . withEnumerationProtection ( ) ;
723+ } ) ;
724+ props . setProps ( { withSignUp : true } ) ;
725+ fixtures . signIn . create . mockReturnValueOnce ( Promise . resolve ( { status : 'needs_first_factor' } as SignInResource ) ) ;
726+ const { userEvent } = render ( < SignInStart /> , { wrapper } ) ;
727+ await userEvent . type ( screen . getByLabelText ( / u s e r n a m e / i) , 'hello' ) ;
728+ await userEvent . click ( screen . getByText ( 'Continue' ) ) ;
729+ expect ( fixtures . signIn . create ) . toHaveBeenCalledWith (
730+ expect . not . objectContaining ( {
731+ signUpIfMissing : true ,
732+ } ) ,
733+ ) ;
734+ } ) ;
682735 } ) ;
683736
684737 describe ( 'ticket flow' , ( ) => {
0 commit comments