优化
This commit is contained in:
@@ -4,6 +4,13 @@ import test from 'node:test'
|
||||
import { buildDirectPaidBody, findDirectPaidCost, findOpenSettlement } from './finance-direct-paid-isolation.mjs'
|
||||
|
||||
const source = await readFile(new URL('./finance-direct-paid-isolation.mjs', import.meta.url), 'utf8')
|
||||
const acceptance = await readFile(new URL('../admin-test-env-acceptance.mjs', import.meta.url), 'utf8')
|
||||
|
||||
test('直接收付款幂等在全量结清模块消费 AR/AP 之前执行', () => {
|
||||
const modules = acceptance.match(/const CONFIGURED_MODULES = \[([^\n]+)\]/)?.[1] || ''
|
||||
assert.ok(modules.indexOf("'finance-reconciliation-full'") < modules.indexOf("'finance-direct-paid-isolation'"))
|
||||
assert.ok(modules.indexOf("'finance-direct-paid-isolation'") < modules.indexOf("'finance-settlement-full'"))
|
||||
})
|
||||
|
||||
test('DIRECT_PAID 请求只绑定客户、仓库、供应商且不伪造业务关联', () => {
|
||||
const body = buildDirectPaidBody('RUN-001', { customerId: '101', customerName: '客户A' },
|
||||
|
||||
@@ -24,6 +24,9 @@ test('商户夹具通过正式 File 和 IAM 审核流程建立下单资格', ()
|
||||
assert.match(fixture, /MERCHANT_TEST_USERNAME/)
|
||||
assert.match(fixture, /MERCHANT_TEST_PASSWORD/)
|
||||
assert.match(fixture, /context\.options\?\.customerName/)
|
||||
assert.match(acceptance, /administrator-phone-availability\?phone=/)
|
||||
assert.match(acceptance, /attempt < 100/)
|
||||
assert.doesNotMatch(acceptance, /phoneSequence % 10/)
|
||||
assert.doesNotMatch(fixture, /internal\/iam|UPDATE\s+iam_|INSERT\s+INTO\s+iam_/i)
|
||||
})
|
||||
|
||||
|
||||
+11
-2
@@ -34,7 +34,7 @@ function fixture() {
|
||||
scenarios: [],
|
||||
calls,
|
||||
createdResources: {
|
||||
merchantQualificationFixture: { tenantId: '1001' },
|
||||
merchantQualificationFixture: { tenantId: '1999' },
|
||||
phase4OverseasBusiness: {
|
||||
purchase: { orderNo: 'PO-1', customerId: '1001' },
|
||||
truck: { orderNo: 'TK-1', customerId: '1001' },
|
||||
@@ -143,9 +143,18 @@ test('five fee types traverse Lastleg lifecycle and reach Finance through real H
|
||||
for (const field of ['businessId', 'orderId', 'inboundId', 'inboundCode', 'containerId', 'containerBookingId', 'containerNo']) {
|
||||
assert.equal(warehouseCreate.body[field], null, field)
|
||||
}
|
||||
assert.equal(warehouseCreate.body.customerId, '1001')
|
||||
assert.equal(warehouseCreate.body.customerId, '1999')
|
||||
assert.equal(warehouseCreate.body.warehouseId, '9001')
|
||||
|
||||
for (const [path, customerId] of [
|
||||
['/api/platform/v1/last-leg/overseas-procurements', '1001'],
|
||||
['/api/platform/v1/last-leg/us-truck-orders', '1001'],
|
||||
['/api/platform/v1/last-leg/local-looseboard-orders', '1001'],
|
||||
]) {
|
||||
const lookup = context.calls.find((call) => call.method === 'GET' && call.path.startsWith(`${path}?`))
|
||||
assert.equal(new URLSearchParams(lookup.path.split('?')[1]).get('customerId'), customerId)
|
||||
}
|
||||
|
||||
const creates = context.calls.filter((call) => call.method === 'POST'
|
||||
&& call.path === '/api/platform/v1/last-leg/finance-fee-sources')
|
||||
assert.equal(creates.length, 12)
|
||||
|
||||
Reference in New Issue
Block a user