Files
baiyue-firstleg/scripts/admin-test-env-modules/finance-extended-settlement-contract.test.mjs
T
2026-08-12 20:02:09 +08:00

53 lines
2.4 KiB
JavaScript

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')
const fixtureSource = await readFile(new URL('./finance-full-fixtures.mjs', import.meta.url), 'utf8')
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, /收款幂等重放不重复入账/)
assert.match(source, /第三张 AP 全额付款且幂等重放/)
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/)
})
test('按柜 PAYABLE 费用携带有效往来单位', () => {
assert.match(fixtureSource, /partnerId: id\(supplier\.id\)/)
assert.match(fixtureSource, /partnerName: supplier\.partnerName \|\| null/)
})