/** * TC-IDENTITY_API-013 · 查看身份认证的办理结果(同 REQ-048,连接器之间交互) * REQ-061 [FL-1.2] 正向/边界值 P1 * * 前置:已完成一次身份认证操作 / 用户有查看记录的权限 * 步骤:调用"身份认证"接口 → 查询刚办理的记录 → 查看详情和相关记录 * 预期:能查到正确的身份认证结果,列表、详情和相关记录一致。 */ export const meta = { tc: 'TC-IDENTITY_API-013', req: 'REQ-061', title: '查看身份认证的办理结果', type: '正向/边界值', priority: 'P1', route: '', needs: ['be'] } export async function run(t) { let token = null await t.step('前置:完成一次身份认证', async () => { await t.login() token = t.token t.assert(!!token, '身份认证已办结') }) await t.step('核对 1:当前会话身份信息完整', async () => { const r = await t.api('GET', '/api/oauth/CurrentUser') t.assert(r.code === 200, `CurrentUser code=${r.code}`) t.assert(!!r.data?.userInfo, `userId=${r.data?.userInfo?.userId}`) }) await t.step('核对 2:查到的用户身份记录与会话一致', async () => { const cu = await t.api('GET', '/api/oauth/CurrentUser') const userId = cu.data.userInfo.userId const detail = await t.api('GET', `/api/permission/Users/${userId}`) t.assert(!!detail, `用户详情拿到 id=${detail?.id}`) t.assert(String(detail.id) === String(userId), '详情 id == CurrentUser userId') t.assert(detail.account === cu.data.userInfo.userAccount, `account(${detail.account})== CurrentUser userAccount(${cu.data.userInfo.userAccount})`) }) await t.step('核对 3:历史会话没有被覆盖', async () => { // 重复一次 CurrentUser,结果应当稳定 const r1 = await t.api('GET', '/api/oauth/CurrentUser') const r2 = await t.api('GET', '/api/oauth/CurrentUser') t.assert(r1.code === 200 && r2.code === 200, `两次 CurrentUser 都返回 200`) t.assert(r1.data.userInfo.userId === r2.data.userInfo.userId, `userId 不变(${r1.data.userInfo.userId})`) }) }