@@ -26,6 +26,7 @@ import {
2626 USER_ROW_SIGN_IN ,
2727 invitationProofIdentifier ,
2828 oneStepSignInState ,
29+ readUserRowSignIn ,
2930 type OneStepAccountReading ,
3031 type OneStepSignInState ,
3132 type StandingGrantObject ,
@@ -1009,6 +1010,19 @@ describe('#34257 — the door sets a password on an existing account only where
10091010 ] ) ;
10101011 } ) ;
10111012
1013+ it ( 'the user row reading is ok only for the one stored row; no read surface, a failed read or no row is not' , async ( ) => {
1014+ const engine = createMemoryEngine ( ) ;
1015+ await engine . insert ( 'sys_user' , { id : 'u_row' , email : 'row@example.com' , phone_number : '+15550134260' } ) ;
1016+ await engine . insert ( 'sys_user' , { id : 'u_bare' , email : 'bare@example.com' } ) ;
1017+ expect ( await readUserRowSignIn ( engine , 'u_row' ) ) . toEqual ( { ok : true , values : { phone_number : '+15550134260' } } ) ;
1018+ expect ( await readUserRowSignIn ( engine , 'u_bare' ) ) . toEqual ( { ok : true , values : { phone_number : undefined } } ) ;
1019+ expect ( await readUserRowSignIn ( engine , 'u_missing' ) ) . toEqual ( { ok : false } ) ;
1020+ expect ( await readUserRowSignIn ( undefined , 'u_row' ) ) . toEqual ( { ok : false } ) ;
1021+ const leave = findThrowsForUserRowSignIn ( engine ) ;
1022+ expect ( await readUserRowSignIn ( engine , 'u_row' ) ) . toEqual ( { ok : false } ) ;
1023+ leave ( ) ;
1024+ } ) ;
1025+
10121026 it ( 'a phone number on the user row answers sign_in with phone sign-in mounted, and is accepted once it is cleared' , async ( ) => {
10131027 const { engine, manager, invite } = await boot ( { plugins : { phoneNumber : true } } ) ;
10141028 const email = 'phone-mounted@example.com' ;
0 commit comments