/** * TC-IDENTITY_API-007 · 正常办理身份更新(接口级) * REQ-049 [FL-1.3] 正向/场景法 P0 * * 前置:已绑定连接器的机构用户或已认证连接器 / 通过已认证的调用方连接器调用"身份更新"接口可以正常打开 / 已准备好测试数据 * 步骤:调用"身份更新"接口 → 按接口说明填写或选择正确的数据 → 提交,查看办理结果 * 预期:身份更新办理成功,系统按要求完成处理,状态和记录正确。 * * 身份更新接口:JNPF /api/permission/Users/{id} + SSW /api/ssw/tdc/Member/{id}/UpdateProfile。 * 本用例优先验证 Member 自研接口。 */ export const meta = { tc: 'TC-IDENTITY_API-007', req: 'REQ-049', title: '正常办理身份更新', type: '正向/场景法', priority: 'P0', route: '', needs: ['be'] } export async function run(t) { let memberId = null let newPhone = null await t.step('前置:登录、准备一条 NORMAL 会员', async () => { await t.login() const list = await t.apiList('/api/ssw/tdc/Member', { pageSize: 20 }) const target = list.find((m) => m.status !== 'CANCELLED') if (!target) t.skip('库内找不到 NORMAL 状态 Member') memberId = target.id t.assert(true, `目标 id=${memberId}`) }) await t.step('正向:调用 UpdateProfile 接口更新联系电话', async () => { newPhone = '139' + String(Date.now()).slice(-8) const r = await t.api('PUT', `/api/ssw/tdc/Member/${memberId}/UpdateProfile`, { contactPhone: newPhone }) t.assert(r && r.code === 200, `UpdateProfile 调用成功(code=${r?.code} msg=${r?.msg})`) }) await t.step('核对:详情接口拿回新联系电话', async () => { const detail = await t.api('GET', `/api/ssw/tdc/Member/${memberId}`) t.assert(detail.contactPhone === newPhone, `联系电话已更新为 ${newPhone}(实际 ${detail.contactPhone})`) }) await t.step('核对:列表检索辅助验证(keyword 口径可能不含 contactPhone)', async () => { const list = await t.apiList('/api/ssw/tdc/Member', { keyword: newPhone }) const hit = list.find((m) => m.id === memberId) if (hit) { t.assert(true, `列表关键字「${newPhone}」命中目标记录`) } else { t.log(`ℹ 列表 keyword 过滤口径不含 contactPhone,未命中;详情接口已确认更新生效,不单独判失败`) } }) }