Skip to content

Commit fa70eaa

Browse files
committed
test(plugin-auth): the demo-staff refusal fixture is a SCIM-held identity
Its set-manager refusal now needs a sys_scim_subject row beside the idp_provisioned mark, so the fixture carries one. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
1 parent e1a0350 commit fa70eaa

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎packages/plugins/plugin-auth/src/demo-staff.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ describe('provisioning — a failure after sign-up says the account exists', ()
242242
* the cross-organization screen stays out of these cases, as it does for any
243243
* identity without one.
244244
*/
245-
function managerEngine(users: Array<Record<string, unknown>>) {
245+
function managerEngine(users: Array<Record<string, unknown>>, scimSubjects: Array<Record<string, unknown>> = []) {
246246
const updates: Array<Record<string, unknown>> = [];
247247
const engine: DemoStaffEngine = {
248248
async find(object, query) {
249-
const matched = object === 'sys_user' ? selectRows(users, (query.where ?? {}) as Record<string, unknown>) : [];
249+
const rows = object === 'sys_user' ? users : object === 'sys_scim_subject' ? scimSubjects : null;
250+
const matched = rows ? selectRows(rows, (query.where ?? {}) as Record<string, unknown>) : [];
250251
return typeof query.limit === 'number' ? matched.slice(0, query.limit) : matched;
251252
},
252253
async update(object, data, options) {
@@ -392,13 +393,13 @@ describe('provisioning — each declared manager is linked once every entry has
392393
});
393394

394395
it('a link the set-manager write refuses is reported with its code and reason', async () => {
395-
// A directory-owned identity: the set-manager write's refusal 5. The
396-
// provisioning carries no copy of that rule; this is the shared one.
396+
// An identity a SCIM directory holds: the set-manager write's refusal 5.
397+
// The provisioning carries no copy of that rule; this is the shared one.
397398
const users: Array<Record<string, unknown>> = [
398399
{ id: 'u_c1', email: 'counsel1@legal.example', manager_id: null, source: 'idp_provisioned' },
399400
{ id: 'u_lead', email: 'lead@legal.example', manager_id: null },
400401
];
401-
const { engine, updates, signUp } = managerEngine(users);
402+
const { engine, updates, signUp } = managerEngine(users, [{ id: 'sub_1', user_id: 'u_c1' }]);
402403

403404
const outcome = await provisionDemoStaff(STAFF, deps(engine, signUp));
404405

0 commit comments

Comments
 (0)