test: select live unpaid settlement fixture

This commit is contained in:
2026-09-04 18:16:27 +08:00
parent 991bab9cb1
commit 7c5ed85a36
2 changed files with 22 additions and 2 deletions
@@ -37,6 +37,7 @@ function fakeContext(overrides = {}) {
...overrides }
const calls = []; const assertions = []; const gaps = []; const steps = []
return { marker: 'T1', token: 'token', createdResources: { financeFullFixtures: fixture }, calls, assertions, gaps, steps,
financeState: { balances, paidAmounts, statuses, versions },
addStep(module, name, response, passed, evidence, options) { steps.push({ module, name, passed, evidence, options }) }, addCoverageGap(...args) { gaps.push(args) },
assert(module, name, res, condition) { assertions.push({ name, condition }); assert.equal(condition, true, name) },
async request(method, path, body, token, headers) {
@@ -113,6 +114,17 @@ test('正式结算动作仅使用本轮 fixture,覆盖 VOID/REOPEN、重放、
}
})
test('结算动作按实时详情跳过已被前置幂等场景部分收款的陈旧 fixture', async () => {
const context = fakeContext()
context.financeState.balances.set('101', 99.99)
context.financeState.paidAmounts.set('101', 0.01)
context.financeState.statuses.set('101', 'PARTIALLY_PAID')
await run(context)
const firstAction = context.calls.find((call) => call.path.endsWith('/actions'))
assert.match(firstAction.path, /\/settlements\/102\/actions$/)
assert.equal(context.gaps.length, 0)
})
test('冻结共享输入使用 4 条 statements、3 条 AR 和 payableSettlements 数组', async () => {
const context = fakeContext()
assert.equal(context.createdResources.financeFullFixtures.statements.length, 4)