优化
This commit is contained in:
@@ -41,7 +41,7 @@ function fakeContext(overrides = {}) {
|
||||
} }
|
||||
}
|
||||
|
||||
test('values 兼容数组、records 和 named map', () => {
|
||||
test('values helper supports nested arrays while run consumes frozen top-level arrays', () => {
|
||||
assert.deepEqual(values([{ id: 1 }]), [{ id: 1 }])
|
||||
assert.deepEqual(values({ records: [{ id: 2 }] }), [{ id: 2 }])
|
||||
assert.deepEqual(values({ marker: 'x', selected: { id: 3 } }), [{ id: 3 }])
|
||||
@@ -83,3 +83,20 @@ test('缺 fixture 或真实 voucher 时记录 blocker 且不写接口', async ()
|
||||
assert.equal(noVoucher.steps.length, 1); assert.equal(noVoucher.steps[0].passed, false)
|
||||
assert.equal(noVoucher.steps[0].options.deploymentBlocker, true)
|
||||
})
|
||||
|
||||
test('AR/AP 数组为空或不完整时原子阻断且不查询、不写入', async () => {
|
||||
const empty = fakeContext({ statements: [], receivableSettlements: [], payableSettlements: [] })
|
||||
await run(empty)
|
||||
assert.equal(empty.calls.length, 0)
|
||||
assert.equal(empty.gaps.length, 1)
|
||||
assert.equal(empty.steps[0].passed, false)
|
||||
assert.match(empty.steps[0].evidence, /actual AR=0, AP=0/)
|
||||
|
||||
const partial = fakeContext({ receivableSettlements: [
|
||||
{ settlementId: '101', statementId: '11', direction: 'RECEIVABLE', status: 'ISSUED' },
|
||||
] })
|
||||
await run(partial)
|
||||
assert.equal(partial.calls.length, 0)
|
||||
assert.equal(partial.gaps.length, 1)
|
||||
assert.match(partial.steps[0].evidence, /actual AR=1, AP=1/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user