This commit is contained in:
2026-10-27 17:44:41 +08:00
parent 57cd211973
commit db0e72daeb
37 changed files with 701 additions and 671 deletions
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { buildContainerCostBody, buildSupplierBody, normalizeFinanceFixtureSources, run,
import { buildContainerCostBody, normalizeFinanceFixtureSources, run,
supplierCategoryForFeeItem, loadSupplier, ensureCustomerChargeRule } from './finance-full-fixtures.mjs'
for (const mode of ['single', 'default', 'missing', 'wrong mode', 'foreign customer', 'ambiguous', 'two defaults']) {
@@ -115,15 +115,11 @@ test('PAYABLE fee selection uses only the explicit nullable supplierCategory fie
assert.match(source, /payableSupplierCategory && source\.supplierCategory !== payableSupplierCategory/)
})
test('Finance PAYABLE fixture creates an isolated ACTIVE supplier through the formal API', () => {
const body = buildSupplierBody('ADMIN-API-20260815-FINANCE', 'BOOKING')
assert.equal(body.category, 'BOOKING')
assert.deepEqual(body.carrierCodes, ['MATSON'])
assert.equal(Object.hasOwn(body, 'scope'), false)
assert.equal(body.status, 'ACTIVE')
assert.match(body.name, /^财务验收供应商-/)
assert.match(source, /POST', '\/api\/platform\/v1\/suppliers\?tenantId=0'/)
assert.match(source, /detail\?\.status === 'ACTIVE' && \(!category \|\| detail\?\.category === category\)/)
test('Finance supplier helper always reuses existing masters and has no create fallback', () => {
const helper = source.slice(source.indexOf('export async function loadSupplier'), source.indexOf('async function uploadVoucher'))
assert.ok(!helper.includes("request(context, 'POST'"))
assert.ok(helper.includes('禁止自动创建'))
assert.ok(!helper.includes('fixedCustomerId'))
})
test('Finance measurement can reuse real pallets from the selected pricing warehouse', () => {