Files
ssw-mvp/docs/e2e/cases/TC-IDENTITY-008.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

53 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-IDENTITY-008 · 条件不满足时不能办理身份更新
* REQ-003 [FL-1.3] 反向/等价类 P0
*
* 前置:【身份管理】可打开 / 已准备无权限账号或错误数据
* 步骤:使用无权限账号或错误数据办理身份更新 → 点击提交,查看提示与数据
* 预期:系统不允许办理身份更新,并说明原因。原有数据和状态不变。
*
* 身份更新的反向:调用 /api/ssw/tdc/Member/{badId}/UpdateProfile 应被业务拒绝。
*/
export const meta = {
tc: 'TC-IDENTITY-008',
req: 'REQ-003',
title: '条件不满足时不能办理身份更新',
type: '反向/等价类',
priority: 'P0',
route: '',
needs: ['be']
}
export async function run(t) {
let beforeEmail = null
let beforeId = null
await t.step('前置:登录并锁定一条会员基线资料', async () => {
await t.login()
const list = await t.apiList('/api/ssw/tdc/Member', { pageSize: 1 })
if (!list.length) t.skip('库内没有任何 Member,无基线可断言')
const target = list.find((m) => m.status !== 'CANCELLED') || list[0]
beforeId = target.id
beforeEmail = target.email
t.assert(true, `基线会员 id=${beforeId} email=${beforeEmail}`)
})
await t.step('反向 1:对一个不存在 id 调用 UpdateProfile,应被业务拒绝', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Member/NON_EXIST_E2E_ID/UpdateProfile', {
email: '[email protected]'
})
t.assert(r && r.code !== 200, `不存在 id 被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('反向 2:用伪造 token 调用 UpdateProfile,应被 sa-token 拦截', async () => {
const r = await t.api('PUT', `/api/ssw/tdc/Member/${beforeId}/UpdateProfile`, { email: '[email protected]' }, { token: 'bearer invalid.token.fake' })
t.assert(r && String(r.code) !== '200', `伪造 token 被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('核对:原会员资料未被改动', async () => {
const detail = await t.api('GET', `/api/ssw/tdc/Member/${beforeId}`)
t.assert(detail.email === beforeEmail, `原邮箱未被脏改(基线 ${beforeEmail},实际 ${detail.email})`)
t.assert(detail.email !== '[email protected]', '非法请求未污染数据')
})
}