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

26 lines
1.4 KiB
JavaScript

/**
* TC-CONTRACT_API-011 · 条件不满足时不能办理数字合约签订(接口)
* REQ-012 [FL-5.2] 反向/等价类 P0
*/
export const meta = { tc: 'TC-CONTRACT_API-011', req: 'REQ-012', title: '条件不满足时不能办理数字合约签订', type: '反向/等价类', priority: 'P0', needs: ['be'] }
export async function run(t) {
await t.login()
const list = await t.apiList('/api/ssw/tds/Contract')
// 已生效合约不能再签
const eff = list.find((c) => c.status === '02')
if (eff) {
const r = await t.api('PUT', `/api/ssw/tds/Contract/${eff.id}/Sign`, { role: 'PROVIDER', signature: 'x' })
t.assert(r.code !== 200 || /已签|生效|状态/.test(r.msg || ''), `生效合约再签被拒:code=${r.code} msg=${r.msg || ''}`)
}
// 缺 sign
const pending = list.find((c) => c.status === '01' || !c.status)
if (pending) {
const r = await t.api('PUT', `/api/ssw/tds/Contract/${pending.id}/Sign`, { role: 'PROVIDER', signature: '' })
t.assert(r.code !== 200 || /不能为空|必填/.test(r.msg || ''), `缺 sign 被拒:code=${r.code} msg=${r.msg || ''}`)
}
// 非法 side
if (pending) {
const r = await t.api('PUT', `/api/ssw/tds/Contract/${pending.id}/Sign`, { role: 'INVALID', signature: 'x' })
t.assert(r.code !== 200 || /role|角色|枚举/.test(r.msg || ''), `非法 role 被拒:code=${r.code} msg=${r.msg || ''}`)
}
}