Skip to content

Commit 3c49959

Browse files
committed
test(auth): pin the one-step door's claim stores by name
The judge and door cases iterate a written-out list of the claim stores, and a pin holds the module's standing grants equal to it, so a store moved out of the claims turns its own cases red. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw
1 parent 3e35729 commit 3c49959

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,11 +846,35 @@ describe('#34257 — the door sets a password only where the mailbox is the acco
846846
expect(oneStepSignInState({ ...ALLOWED, ...change })).toBe(reason);
847847
});
848848

849+
// The claim stores, written out: each standing-grant object and the reason
850+
// its row answers. The module derives what it reads from its classification
851+
// table; this list pins that table's claims, so a store moved out of the
852+
// claims turns its cases below red.
853+
const CLAIM_STORES: ReadonlyArray<readonly [StandingGrantObject, OneStepSignInState]> = [
854+
['sys_api_key', 'api_key'],
855+
['sys_oauth_consent', 'oauth_consent'],
856+
['sys_oauth_access_token', 'oauth_token'],
857+
['sys_oauth_refresh_token', 'oauth_token'],
858+
['sys_oauth_application', 'oauth_client'],
859+
['sys_device_code', 'device_code'],
860+
['sys_two_factor', 'second_factor'],
861+
['sys_sso_provider', 'sso_provider'],
862+
['sys_scim_connection_credential', 'scim_credential'],
863+
['sys_scim_user', 'idp_linked'],
864+
['sys_scim_subject', 'idp_linked'],
865+
['sys_scim_projection_grant', 'idp_linked'],
866+
['sys_scim_identity_tombstone', 'idp_linked'],
867+
];
868+
869+
it('the standing grants the door reads are the claim stores', () => {
870+
expect(STANDING_GRANTS.map(({ object, reason }) => [object, reason])).toEqual(CLAIM_STORES.map(([o, r]) => [o, r]));
871+
});
872+
849873
const withGrant = (object: StandingGrantObject, reading: StandingGrantReading | undefined): Partial<OneStepAccountReading> => ({
850874
standingGrants: { ...ALLOWED.standingGrants, [object]: reading } as Record<StandingGrantObject, StandingGrantReading>,
851875
});
852876

853-
it.each(STANDING_GRANTS.map(({ object, reason }) => [object, reason] as const))(
877+
it.each(CLAIM_STORES)(
854878
'the judge answers sign_in for a row of %s, as %s, and as grant_unreadable when it cannot be read or was not read',
855879
(object, reason) => {
856880
expect(oneStepSignInState({ ...ALLOWED, ...withGrant(object, { ok: true, held: true }) })).toBe(reason);
@@ -884,7 +908,7 @@ describe('#34257 — the door sets a password only where the mailbox is the acco
884908
// One boot for every store: each store has its own invitation, account and
885909
// client address, so no window counts another's requests.
886910
let shared: Promise<Awaited<ReturnType<typeof boot>>> | undefined;
887-
it.each(STANDING_GRANT_OBJECTS.map((object, i) => [object, i] as const))(
911+
it.each(CLAIM_STORES.map(([object], i) => [object, i] as const))(
888912
'an unverified account holding a row of %s signs in as today, and is accepted once the row is gone',
889913
async (object, i) => {
890914
shared ??= boot();

0 commit comments

Comments
 (0)