Files
ssw-mvp/docs/e2e/cases/TC-CONTRACT_API-009.mjs
T
admin 4585d15d5f chore: snapshot source work — e2e fixes, backend/web, docs
- e2e: fix 9 failing cases (contract/hosting/delivery/usage/security);
  add dsl.createSandboxTask() self-provision helper; cli/runner now
  default headless, --ob opens visible browser
- backend: tdc/tds controller adjustments (delivery, hosting, contract,
  chain-evidence, catalog, product, policy-conflict, etc.)
- web: ssw views/components adjustments (contract, product, hosting, connector)
- docs: AGENTS.md, e2e README; .gitignore; project memory update

Excludes docs/e2e/results artifacts (screenshots + results.json).
2026-08-06 14:02:07 +08:00

18 lines
1.0 KiB
JavaScript

/**
* TC-CONTRACT_API-009 · 重复办理合约备案时不会重复处理(接口)
* REQ-012 [FL-5.2] 反向/错误推测 P1
*/
export const meta = { tc: 'TC-CONTRACT_API-009', req: 'REQ-012', title: '重复办理合约备案时不会重复处理', type: '反向/错误推测', priority: 'P1', needs: ['be'] }
export async function run(t) {
await t.login()
const list = await t.apiList('/api/ssw/tds/Contract')
const target = list.find((c) => c.status === '02' && !c.chainTxHash)
if (!target) t.skip('无待上链合约')
const txHash = '0x' + 'c'.repeat(64)
const before = (await t.apiList('/api/ssw/tds/ChainEvidence/List')).length
await t.api('PUT', `/api/ssw/tds/Contract/${target.id}/Chain`, { chainTxHash: txHash })
await t.api('PUT', `/api/ssw/tds/Contract/${target.id}/Chain`, { chainTxHash: txHash })
await t.waitIdle()
const after = (await t.apiList('/api/ssw/tds/ChainEvidence/List')).length
t.assert(after === before + 1, `重复备案仅产生 1 条存证(${before} → ${after}),幂等`)
}