- 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
70 lines
3.5 KiB
JavaScript
70 lines
3.5 KiB
JavaScript
/**
|
||
* TC-CONNECTOR_API-003 · 查看连接器注册、更新、撤销的办理结果
|
||
* REQ-060 [FL-3.1] 反向/错误推测 P1
|
||
*
|
||
* 前置:已完成一次注册+更新+撤销 / 用户有查看记录的权限
|
||
* 步骤:通过接口查询刚才办理的记录 → 查看详情与相关记录
|
||
* 预期:能查到正确的注册/更新/撤销结果,列表、详情与相关记录一致
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-CONNECTOR_API-003',
|
||
req: 'REQ-060',
|
||
title: '查看连接器注册、更新、撤销的办理结果',
|
||
type: '反向/错误推测',
|
||
priority: 'P1',
|
||
route: '',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.login()
|
||
let cancelled = null
|
||
let passed = null
|
||
|
||
await t.step('前置:从库中挑选已撤销与已审批通过的样本', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/Connector', { pageSize: 100 })
|
||
cancelled = list.find((r) => r.status === 'CANCELLED')
|
||
passed = list.find((r) => r.auditStatus === 'PASS')
|
||
if (!cancelled) t.skip('库中没有 CANCELLED 的连接器,请先跑 TC-CONNECTOR_API-001')
|
||
t.assert(true, `已就绪:CANCELLED=${cancelled.connectorCode}, PASS=${passed?.connectorCode ?? '-'}`)
|
||
})
|
||
|
||
await t.step('列表按状态/标识筛选', async () => {
|
||
const byStatus = await t.apiList('/api/ssw/tds/Connector', { status: 'CANCELLED', pageSize: 50 })
|
||
t.assert(byStatus.some((r) => r.id === cancelled.id), `按 status=CANCELLED 能查到该记录`)
|
||
const byCode = await t.apiList('/api/ssw/tds/Connector', { keyword: cancelled.connectorCode })
|
||
t.assert(byCode.some((r) => r.id === cancelled.id), `按关键字能查到该记录`)
|
||
})
|
||
|
||
await t.step('详情接口核对撤销记录的所有字段', async () => {
|
||
const info = await t.api('GET', `/api/ssw/tds/Connector/${cancelled.id}`)
|
||
t.assert(info.code === 200, `详情接口返回 200(实际 ${info.code})`)
|
||
t.assert(info.data.status === 'CANCELLED', `详情 status=CANCELLED`)
|
||
t.assert(info.data.connectorCode === cancelled.connectorCode, `connectorCode 一致`)
|
||
t.assert(!!info.data.cancelTime, `cancelTime 已记录(${info.data.cancelTime})`)
|
||
t.assert(!!info.data.cancelReason, `cancelReason 已记录(${info.data.cancelReason})`)
|
||
t.assert(!!info.data.dataRetentionUntil, `dataRetentionUntil 已记录(${info.data.dataRetentionUntil})`)
|
||
// 注销后 3 年留存:现在 < 留存截止
|
||
const until = new Date(info.data.dataRetentionUntil).getTime()
|
||
const now = Date.now()
|
||
const years = (until - now) / (1000 * 60 * 60 * 24 * 365)
|
||
t.assert(years > 2.9 && years < 3.5, `dataRetentionUntil 与 now 相差约 3 年(实际 ${years.toFixed(2)} 年)`)
|
||
})
|
||
|
||
await t.step('PASS 状态详情核对接入审批字段', async () => {
|
||
if (!passed) return
|
||
const info = await t.api('GET', `/api/ssw/tds/Connector/${passed.id}`)
|
||
t.assert(info.data.auditStatus === 'PASS', `auditStatus=PASS(实际 ${info.data.auditStatus})`)
|
||
t.assert(!!info.data.auditTime, `auditTime 已记录(${info.data.auditTime})`)
|
||
})
|
||
|
||
await t.step('列表分页参数生效', async () => {
|
||
const a = await t.apiList('/api/ssw/tds/Connector', { currentPage: 1, pageSize: 5 })
|
||
const b = await t.apiList('/api/ssw/tds/Connector', { currentPage: 2, pageSize: 5 })
|
||
t.assert(a.length <= 5, `第一页条数 ≤ 5(实际 ${a.length})`)
|
||
// 不同页至少有一条不同(除非库不够)
|
||
if (a.length === 5) {
|
||
t.assert(a[0]?.id !== b[0]?.id, `翻页能拿到不同记录(除非库不够)`)
|
||
}
|
||
})
|
||
} |