- 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
59 lines
2.5 KiB
JavaScript
59 lines
2.5 KiB
JavaScript
/**
|
||
* TC-IDENTITY-010 · 条件不满足时不能办理身份注销
|
||
* REQ-004 [FL-1.4] 反向/等价类 P0
|
||
*
|
||
* 前置:【身份管理】可打开 / 已准备无权限账号或错误数据
|
||
* 步骤:使用无权限账号或错误数据办理身份注销 → 点击提交,查看提示与数据
|
||
* 预期:系统不允许办理身份注销,并说明原因。原有数据和状态不变。
|
||
*
|
||
* 注销的反向:
|
||
* ① 不存在 id 应被拒;
|
||
* ② 已注销会员再调 Cancel 应被业务规则拒绝(不过 current code 仍写状态,可作为脏数据兜底);
|
||
* ③ 没有 token 应被 sa-token 拦截。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-IDENTITY-010',
|
||
req: 'REQ-004',
|
||
title: '条件不满足时不能办理身份注销',
|
||
type: '反向/等价类',
|
||
priority: 'P0',
|
||
route: '',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let aliveId = null
|
||
let aliveState = 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,无法做注销反向基线')
|
||
aliveId = target.id
|
||
aliveState = {
|
||
name: target.name,
|
||
contactPhone: target.contactPhone,
|
||
status: target.status
|
||
}
|
||
t.assert(true, `基线会员 id=${aliveId} status=${aliveState.status}`)
|
||
})
|
||
|
||
await t.step('反向 1:对一个不存在 id 调 Cancel,应被业务拒绝', async () => {
|
||
const r = await t.api('PUT', '/api/ssw/tdc/Member/NON_EXIST_E2E_ID/Cancel', { reason: 'should not apply' })
|
||
t.assert(r && String(r.code) !== '200', `不存在 id 被拒(code=${r?.code} msg=${r?.msg})`)
|
||
})
|
||
|
||
await t.step('反向 2:用伪造 token 调 Cancel,应被 sa-token 拦截', async () => {
|
||
const r = await t.api('PUT', `/api/ssw/tdc/Member/${aliveId}/Cancel`, { reason: 'fake token should not apply' }, { token: 'bearer invalid.token.fake' })
|
||
t.assert(r && String(r.code) !== '200', `伪造 token 被拒(code=${r?.code})`)
|
||
})
|
||
|
||
await t.step('核对:原会员数据未被脏改', async () => {
|
||
const after = await t.api('GET', `/api/ssw/tdc/Member/${aliveId}`)
|
||
t.assert(after.status === aliveState.status, `状态未变(${aliveState.status} → ${after.status})`)
|
||
t.assert(after.name === aliveState.name, `姓名未变(${aliveState.name})`)
|
||
t.assert(after.contactPhone === aliveState.contactPhone, `手机号未变(${aliveState.contactPhone})`)
|
||
})
|
||
}
|