This commit is contained in:
2026-11-04 18:08:19 +08:00
parent 0993dd446e
commit 51291b4c27
16 changed files with 468 additions and 47 deletions
@@ -29,6 +29,29 @@ test('fixed Client authenticates and verifies ownership without registration', a
await assert.rejects(scope.reuseFixedClient(), /fixed customer identity/)
})
test('固定客户补回企业资料、资质及角色成员查询,全程只读且校验归属', async () => {
const calls = []
const scope = vm.createContext({ fixedCustomerId: '123', merchantToken: 'existing-session', report: {},
assertEqual: assert.equal, assertTrue: assert.ok,
requireSuccess: json => assert.equal(json.code, 200),
async apiStep(_module, _name, request, validate) {
calls.push(request)
assert.equal(request.method, 'GET')
assert.equal(request.token, 'existing-session')
const json = { code: 200, data: request.path.endsWith('/tenant/profile')
? { id: '123', status: 'ACTIVE' } : [] }
validate({ json }); return { json }
},
})
const helper = source.slice(source.indexOf('async function fixedClientReadOnlyModule()'), source.indexOf('async function registrationModule()'))
vm.runInContext(helper, scope)
await scope.fixedClientReadOnlyModule()
assert.equal(calls.length, 6)
assert.deepEqual([...scope.report.readOnlyCoverage], ['qualification-review', 'profile-management', 'rbac-members'])
scope.fixedCustomerId = '999'
await assert.rejects(scope.fixedClientReadOnlyModule(), /fixed customer read-only identity/)
})
test('client registration distinguishes incomplete-registration replay from credential conflicts', () => {
assert.match(source, /same credentials replay the incomplete registration/)
assert.match(source, /\['accountId', 'tenantId', 'membershipId'\]/)