Files

55 lines
2.5 KiB
JavaScript
Raw Permalink Normal View History

2026-08-12 17:45:45 +08:00
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
const moduleUrl = new URL('./finance-extended-settlement.mjs', import.meta.url)
const source = await readFile(moduleUrl, 'utf8')
2026-08-12 20:02:09 +08:00
const fixtureSource = await readFile(new URL('./finance-full-fixtures.mjs', import.meta.url), 'utf8')
2026-08-12 17:45:45 +08:00
test('扩展财务验收只接受指定独立 marker 且不借历史来源', () => {
assert.match(source, /FIN-EXT-SETTLE-20260812/)
assert.match(source, /context\.marker = `\$\{REQUIRED_MARKER\}-/)
assert.match(source, /runOwnedFixture/)
assert.match(source, /fixture\?\.marker === context\.marker/)
assert.match(source, /禁止借历史来源/)
assert.doesNotMatch(source, /INSERT\s+INTO|UPDATE\s+fin_|DELETE\s+FROM/i)
})
test('扩展财务验收覆盖真实来源、SELECTED 状态机和三 AR 三 AP', () => {
assert.match(source, /finance-full-fixtures\.mjs/)
assert.match(source, /finance-reconciliation-full\.mjs/)
assert.match(source, /generationMode: 'SELECTED'/)
assert.match(source, /WAYBILL-PAYABLE/)
assert.match(source, /receivables\.length !== 3/)
assert.match(source, /payables\.length !== 3/)
assert.match(source, /DUPLICATE-OCCUPANCY/)
assert.match(source, /三张 AR 分别保留未收、部分收、已收清/)
assert.match(source, /三张 AP 分别保留未付、部分付、已付/)
})
test('扩展财务验收覆盖凭证、多单分配、超额拒绝及幂等重放', () => {
assert.match(source, /voucherFileIds: \[fixture\.voucherFileId\]/)
assert.match(source, /allocations\.length === 2/)
assert.match(source, /收款幂等重放不重复入账/)
2026-08-12 18:00:17 +08:00
assert.match(source, /第三张 AP 全额付款且幂等重放/)
2026-08-12 17:45:45 +08:00
assert.match(source, /拒绝超额付款/)
assert.match(source, /requestId/)
assert.match(source, /traceId/)
})
test('扩展财务验收输出可回传资源与柜次部署阻断', () => {
assert.match(source, /financeExtendedSettlement/)
assert.match(source, /statementIds/)
assert.match(source, /receivableSettlementIds/)
assert.match(source, /payableSettlementIds/)
assert.match(source, /statusMatrix/)
assert.match(source, /containerPayableDeploymentBlocker/)
})
2026-08-12 20:02:09 +08:00
2026-08-15 11:05:58 +08:00
test('按柜 PAYABLE 费用携带 Warehouse 供应商', () => {
2026-08-19 09:42:07 +08:00
assert.match(fixtureSource, /supplierId: id\(supplier\.id\)/)
assert.doesNotMatch(fixtureSource, /partnerId|partnerName/)
2026-08-19 09:55:29 +08:00
assert.match(fixtureSource, /POST', '\/api\/platform\/v1\/suppliers\?tenantId=0'/)
assert.match(fixtureSource, /!category \|\| detail\?\.category === category/)
2026-08-12 20:02:09 +08:00
})