Skip to content

Commit 7774f4a

Browse files
committed
test(auth): pin the user row reading of the one-step door
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw
1 parent bdc4812 commit 7774f4a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎packages/plugins/plugin-auth/src/invitation-one-step-acceptance-34257.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)