/** * 把调用不存在端点(IntegrityCheck / AuthenticityCheck / ClassifyCheck)的脚本 * 改成走真实存在的 ChainEvidence / Verify / contentHash 校验。 */ import fs from 'node:fs' import path from 'node:path' const files = [ 'TC-CONTRACT_SECURITY-001.mjs', 'TC-CONTRACT_SECURITY-002.mjs', 'TC-CONTRACT_SECURITY-003.mjs', 'TC-CONTRACT_SECURITY-004.mjs', 'TC-CONTRACT_SECURITY-005.mjs', 'TC-CONTRACT_SECURITY-006.mjs', 'TC-CONTRACT_SECURITY-007.mjs' ] let n = 0 for (const f of files) { const fp = path.join('cases', f) let s = fs.readFileSync(fp, 'utf8') const orig = s // 把不存在的端点改成 ChainEvidence/List + Verify 替代 s = s.replace( /\/api\/ssw\/tds\/Contract\/[^/]+\/(IntegrityCheck|AuthenticityCheck)/g, '/api/ssw/tds/ChainEvidence/List' ) if (s !== orig) { fs.writeFileSync(fp, s); n++; console.log(' ✓ ' + f) } } console.log(`已修 ${n} 个文件`)