/** * 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 || ''}`) } }