This commit is contained in:
2026-08-12 12:35:29 +08:00
parent 0fceece378
commit e4f65dae5f
8 changed files with 434 additions and 41 deletions
@@ -16,7 +16,7 @@ function fakeContext(withFixture = true) {
const marker = 'FIN-TEST-MARKER'
const receivables = [
{ feeSourceId: '101', orderId: '201', direction: 'RECEIVABLE', currency: 'CNY', businessDate: '2026-08-10' },
{ feeSourceId: '102', orderId: '202', direction: 'RECEIVABLE', currency: 'CNY', businessDate: '2026-08-11' },
{ feeSourceId: '102', orderId: '202', direction: 'RECEIVABLE', currency: 'CNY', businessDate: '2026-08-10' },
{ feeSourceId: '103', orderId: '203', direction: 'RECEIVABLE', currency: 'CNY', businessDate: '2026-08-11' },
{ feeSourceId: '104', orderId: '204', direction: 'RECEIVABLE', currency: 'CNY', businessDate: '2026-08-11' },
]
@@ -124,10 +124,12 @@ test('静态契约覆盖日期、SELECTED、三 AR、AP、状态机和数组输
assert.match(source, /generationMode === 'SELECTED'/)
assert.match(source, /businessDates\.size < 2/)
assert.match(source, /receivables\.length < 4/)
assert.match(source, /const groups = \[\[receivables\[0\], receivables\[1\]\]/)
assert.match(source, /const groups = \[cutoffSources/)
assert.match(source, /\/payable-settlements/)
assert.match(source, /fixture\.root\.statements = statementRows/)
assert.match(source, /fixture\.root\.receivableSettlements = arRows/)
assert.doesNotMatch(source, /generationMode:\s*['"]BY_CUTOFF['"]/)
assert.doesNotMatch(source, /\/fee-pool/)
assert.match(source, /http: response\?\.http \?\? null/)
assert.match(source, /requestId: response\?\.requestId \?\? null/)
assert.match(source, /traceId: response\?\.traceId \?\? null/)
@@ -141,8 +143,8 @@ test('run 发布一条日期链、三张独立已出账单、三张 AR 和一张
await run(context)
const fixture = context.createdResources.financeFullFixtures
assert.equal(fixture.statements.length, 4)
assert.equal(fixture.statements[0].kind, 'BY_CUTOFF')
assert.equal(fixture.statements[0].status, 'VOIDED')
assert.equal(fixture.statements[0].kind, 'SELECTED_DATE')
assert.equal(fixture.statements[0].status, 'ISSUED')
assert.deepEqual(fixture.statements.slice(1).map((item) => item.status), ['ISSUED', 'ISSUED', 'ISSUED'])
assert.equal(fixture.receivableSettlements.length, 3)
assert.equal(new Set(fixture.receivableSettlements.map((item) => item.statementId)).size, 3)
@@ -150,6 +152,8 @@ test('run 发布一条日期链、三张独立已出账单、三张 AR 和一张
assert.equal(fixture.payableSettlements[0].supplierId, '501')
assert.equal(fixture.payableSettlements[0].partnerId, '501')
assert.equal(fixture.payableSettlements[0].supplierName, 'Fixture Partner')
assert.equal(context.calls.some((call) => call.path.includes('/fee-pool')
|| call.body?.generationMode === 'BY_CUTOFF'), false)
assert.equal(context.steps.filter((step) => !step.passed).length, 0)
})