Files
ssw-mvp/docs/e2e/cases/TC-USAGE-012.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

89 lines
3.9 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-USAGE-012 · 条件不满足时不能办理使用存证
* REQ-018 [FL-6.3] 反向/等价类 P0
*
* 前置:1. 服务平台的【数据使用控制】可以正常打开
* 2. 已准备无权限账号或错误数据
* 步骤:1. 打开服务平台的【数据使用控制】
* 2. 使用无权限账号或错误数据办理使用存证
* 3. 点击提交,查看提示和数据
* 预期:系统不允许办理使用存证,并说明原因。原有数据和状态不变。
*
* 注:使用存证 = API 消费日志 + 数据销毁日志,两者都是只读存证。
* 销毁日志后端明确拒绝手工 create / delete(合规要求)。
*/
export const meta = {
tc: 'TC-USAGE-012',
req: 'REQ-018',
title: '条件不满足时不能办理使用存证',
type: '反向/等价类',
priority: 'P0',
route: '/tdc/delivery',
needs: ['fe', 'be']
}
export async function run(t) {
let destroyBefore = 0
let apiBefore = 0
await t.step('前置:登录并记录原始存证数据量', async () => {
await t.login()
const destroy = await t.apiList('/api/ssw/tdc/DestroyLog', { pageSize: 100 })
const api = await t.apiList('/api/ssw/tdc/ApiConsumeLog', { pageSize: 100 })
destroyBefore = destroy.length
apiBefore = api.length
t.assert(true, `操作前销毁日志 ${destroyBefore} 条,API 消费日志 ${apiBefore} 条`)
})
await t.step('反向 1:手工 create 销毁日志必须被后端拒绝(合规存证不可造)', async () => {
const res = await t.api('POST', '/api/ssw/tdc/DestroyLog', {
taskId: 'FAKE',
resourceUri: 'fake://test',
method: 'PHYSICAL',
operator: 'e2e',
reason: '测试'
})
t.assert(res.code !== 200, `手工 create 销毁日志被后端拒绝(code=${res.code}, msg=${res.msg})`)
t.assert(
typeof res.msg === 'string' && (res.msg.includes('不可手工') || res.msg.includes('不可') || res.msg.includes('存证')),
`拒绝原因指向合规存证:${res.msg}`
)
})
await t.step('反向 2:手工 delete 销毁日志必须被后端拒绝(合规存证不可删)', async () => {
const list = await t.apiList('/api/ssw/tdc/DestroyLog', { pageSize: 1 })
if (!list.length) t.skip('库中无销毁日志,跳过删除反向用例')
const target = list[0]
const res = await t.api('DELETE', `/api/ssw/tdc/DestroyLog/${target.id}`)
t.assert(res.code !== 200, `手工 delete 销毁日志被后端拒绝(code=${res.code}, msg=${res.msg})`)
t.assert(
typeof res.msg === 'string' && (res.msg.includes('不可删除') || res.msg.includes('存证') || res.msg.includes('合规')),
`拒绝原因指向合规存证:${res.msg}`
)
})
await t.step('反向 3:重复销毁同一任务被拒绝(destroyStatus=DONE)', async () => {
const list = await t.apiList('/api/ssw/tdc/DeliveryTask', { pageSize: 100 })
const target = list.find((r) => r.destroyStatus === 'DONE')
if (!target) t.skip('库中无 destroyStatus=DONE 任务,跳过重复销毁反向用例')
const res = await t.api('PUT', `/api/ssw/tdc/DeliveryTask/${target.id}/Destroy`, {
reason: 'E2E 重复销毁'
})
t.assert(res.code !== 200, `重复销毁被后端拒绝(code=${res.code}, msg=${res.msg})`)
t.assert(
typeof res.msg === 'string' && res.msg.includes('已销毁'),
`拒绝原因指向已销毁:${res.msg}`
)
})
await t.step('核对存证数据条数不变', async () => {
const destroyAfter = (await t.apiList('/api/ssw/tdc/DestroyLog', { pageSize: 100 })).length
const apiAfter = (await t.apiList('/api/ssw/tdc/ApiConsumeLog', { pageSize: 100 })).length
t.assert(destroyAfter === destroyBefore, `销毁日志条数不变(${destroyBefore} → ${destroyAfter})`)
t.assert(apiAfter === apiBefore, `API 消费日志条数不变(${apiBefore} → ${apiAfter})`)
})
t.expectConsoleClean()
}