Files
ssw-mvp/docs/e2e/cases/TC-CONTRACT_API-003.mjs
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

64 lines
2.9 KiB
JavaScript
Raw Permalink 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-CONTRACT_API-003 · 查看合约签订的办理结果
* REQ-056 [FL-5.2] 反向/错误推测 P1
*
* 前置:1. 已完成一次合约签订操作
* 2. 用户有查看记录的权限
* 步骤:1. 打开通过已认证的调用方连接器调用"合约签订"接口
* 2. 查询刚办理的记录
* 3. 查看详情和相关记录
* 预期:能查到正确的合约签订结果,列表、详情和相关记录一致。
*/
export const meta = {
tc: 'TC-CONTRACT_API-003',
req: 'REQ-056',
title: '查看合约签订的办理结果',
type: '反向/错误推测',
priority: 'P1',
route: '',
needs: ['be']
}
export async function run(t) {
let created = null
await t.step('前置:登录并办理一条合约作为查看对象', async () => {
await t.login()
const conns = await t.apiList('/api/ssw/tds/Connector', { pageSize: 50 })
const prods = await t.apiList('/api/ssw/tds/DataProduct', { pageSize: 50 })
const usable = conns.filter((c) => prods.some((p) => p.spaceId === c.spaceId))
if (usable.length < 2) t.skip('同一空间下连接器不足 2 个')
const space = usable[0].spaceId
const product = prods.find((p) => p.spaceId === space).id
const code = t.uid('CT_VIEW')
const res = await t.api('POST', '/api/ssw/tds/Contract', {
contractCode: code, name: '查看对象-' + t.runId, spaceId: space, productId: product,
providerConnectorId: usable[0].id, consumerConnectorId: usable[1].id, purpose: '查看'
})
t.assert(res.code === 200, '构造数据成功')
created = { id: res.data, code, space }
})
await t.step('按 ID 取详情:详情数据应包含本次办理的全部关键字段', async () => {
const r = await t.api('GET', `/api/ssw/tds/Contract/${created.id}`)
t.assert(r.code === 200, '详情接口返回成功')
t.assert(r.data.id === created.id, `详情 ID 一致(${r.data.id})`)
t.assert(r.data.contractCode === created.code, `详情合约标识一致(${r.data.contractCode})`)
t.assert(r.data.status === '01', `详情状态为 01 待签署(实际 ${r.data.status})`)
t.assert(!!r.data.contentHash, '详情带回内容哈希')
})
await t.step('按合约标识精确过滤:列表应只命中这一条', async () => {
// 后端没有 contractCode 过滤列,走 keyword 模糊匹配
const list = await t.apiList('/api/ssw/tds/Contract', { keyword: created.code })
const hit = list.filter((x) => x.contractCode === created.code)
t.assert(hit.length >= 1, `按合约标识查到 ${hit.length} 条记录`)
t.assert(hit[0].id === created.id, '过滤命中记录的 ID 与详情一致')
})
await t.step('按状态过滤(status=01):本条应出现在结果中', async () => {
const list = await t.apiList('/api/ssw/tds/Contract', { status: '01', keyword: created.code })
const hit = list.find((x) => x.id === created.id)
t.assert(!!hit, '待签署合约列表中能查到本条')
})
}