fix(fleet): preserve unknown commercial facts for pooled freight
This commit is contained in:
@@ -2,7 +2,8 @@ import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { parsePoolArguments, poolPlan, runPoolAcceptance, assertPoolRemaining, assertSingleCommercial,
|
||||
shrinkingVehicleRequest, expiryWaitMs, poolLocalDateTime, poolPickScope, pickPoolDispatch, POOL_COVERAGE, POOL_REMAINING,
|
||||
poolInquiryWrite, poolReadIsDenied, assertPoolBoundCapacity, verifyPoolConfirmedCancellation, verifyPoolBindingRevalidation } from './fleet-capacity-pool-test-env.mjs'
|
||||
poolInquiryWrite, poolReadIsDenied, assertPoolBoundCapacity, verifyPoolConfirmedCancellation, verifyPoolBindingRevalidation,
|
||||
assertPoolUnknownCommercialFacts } from './fleet-capacity-pool-test-env.mjs'
|
||||
|
||||
test('default and explicit plans make no network requests or invoke the mutating runner', async () => {
|
||||
const original = globalThis.fetch
|
||||
@@ -167,6 +168,22 @@ test('foreign read rejection requires actual access/not-found code and no leaked
|
||||
{ http: 200, body: { code: 'A0409' } }, { http: 403, body: { data: { orderNo: 'PRIVATE' } } }]) assert.equal(poolReadIsDenied(response), false)
|
||||
})
|
||||
|
||||
test('pool commercial facts accept nullish Jackson fields but reject invented container or palletizing answers', () => {
|
||||
for (const type of ['LOCAL_LOOSEBOARD', 'US_TRUCK']) {
|
||||
for (const summary of [{}, { containerType: null, palletRequired: null }, { containerType: undefined, palletRequired: undefined }]) {
|
||||
assert.doesNotThrow(() => assertPoolUnknownCommercialFacts(type, summary))
|
||||
}
|
||||
for (const containerType of ['40HQ', '40GP', '45HQ', '', 'UNKNOWN', false, 0]) {
|
||||
assert.throws(() => assertPoolUnknownCommercialFacts(type, { containerType }), /CONTAINER_TYPE_MUST_REMAIN_UNKNOWN/)
|
||||
}
|
||||
assert.throws(() => assertPoolUnknownCommercialFacts(type, null), /SUMMARY_REQUIRED/)
|
||||
}
|
||||
for (const palletRequired of ['YES', 'NO', '', 'UNKNOWN', false, 0]) {
|
||||
assert.throws(() => assertPoolUnknownCommercialFacts('LOCAL_LOOSEBOARD', { palletRequired }), /PALLETIZING_SERVICE_MUST_REMAIN_UNKNOWN/)
|
||||
}
|
||||
assert.throws(() => assertPoolUnknownCommercialFacts('OTHER', {}), /SUMMARY_REQUIRED/)
|
||||
})
|
||||
|
||||
test('owner rejection sends a valid current edit rather than malformed input', () => {
|
||||
const source = { tripRecordVersion: 5, offerRecordVersion: 7, recordVersion: 9, customerId: '42', businessType: 'US_TRUCK',
|
||||
deliveryMode: 'SELF_DELIVERY', estimatedArrivalAt: '2030-01-01T00:00:00Z', expectedPalletCount: 1,
|
||||
|
||||
Reference in New Issue
Block a user