test: align wallet ledger assertions with contract

This commit is contained in:
2026-09-06 11:15:48 +08:00
parent 0fbab09890
commit 54af43a99d
2 changed files with 6 additions and 3 deletions
@@ -23,6 +23,9 @@ test('钱包闭环覆盖充值、授信、采购冻结结算和换标结算释
"['VOUCHER', 'RECEIPT']",
"walletStatus === 'FROZEN'",
"walletStatus === 'SETTLED'",
"['FREEZE_PENDING', 'FROZEN']",
"['FREEZE', 'CONSUMPTION', 'UNFREEZE']",
'item.sourceNo === businessNo',
"'RELEASED'",
"terminalStatus === 'COMPLETED'",
"'CANCELLED'",
@@ -142,7 +142,7 @@ async function procurementFlow(context, fixture, overseasToken) {
})
const feeNo = fee?.body?.data?.feeNo
assert(context, '采购费用创建并开始钱包冻结', fee,
success(fee) && Boolean(feeNo) && ['PENDING', 'FROZEN'].includes(fee.body.data?.walletStatus),
success(fee) && Boolean(feeNo) && ['FREEZE_PENDING', 'FROZEN'].includes(fee.body.data?.walletStatus),
`feeNo=${feeNo || 'missing'}, walletStatus=${fee.body?.data?.walletStatus || 'missing'}`)
if (!success(fee) || !feeNo) return null
@@ -229,8 +229,8 @@ async function verifyClientWallet(context, token, fixture, wallet, procurement,
const businessNos = [procurement.feeNo, ...relabels.map((item) => item.relabelNo)]
assert(context, '客户账本包含充值、冻结、结算和释放明细', ledger,
success(ledger) && entries.some((item) => item.changeType === 'RECHARGE')
&& businessNos.every((businessNo) => entries.some((item) => item.businessNo === businessNo))
&& ['FREEZE', 'SETTLE', 'RELEASE'].every((type) => entries.some((item) => item.changeType === type)),
&& businessNos.every((businessNo) => entries.some((item) => item.sourceNo === businessNo))
&& ['FREEZE', 'CONSUMPTION', 'UNFREEZE'].every((type) => entries.some((item) => item.changeType === type)),
`entries=${entries.length}, businessNos=${businessNos.join(',')}`)
return account?.body?.data
}