feat(looseboard): simplify client demand and split route contacts
This commit is contained in:
@@ -142,7 +142,8 @@ test('truck requires both contacts vehicle and minute times without inheriting l
|
||||
const loose = transportHarness('looseboard')
|
||||
assert.equal(loose.rules.value.contactName, undefined)
|
||||
assert.equal(loose.rules.value.contactInfo, undefined)
|
||||
assert.equal(loose.rules.value.transportMode[0].required, true)
|
||||
assert.equal(loose.rules.value.transportMode, undefined)
|
||||
for (const key of ['originContactName', 'originContactPhone', 'destinationContactName', 'destinationContactPhone', 'pickupAt', 'deliveryAt']) assert.equal(loose.rules.value[key][0].required, true)
|
||||
truck.form.pickupAt = '2026-10-20T09:30:00'
|
||||
let failure
|
||||
truck.rules.value.deliveryAt[1].validator({}, '2026-10-20T09:29:00', error => { failure = error })
|
||||
@@ -177,3 +178,30 @@ test('truck details render saved minute times and unknown pool demand without ti
|
||||
assert.equal(fields.has('柜型'), false)
|
||||
assert.equal(fields.has('托盘数'), false)
|
||||
})
|
||||
|
||||
|
||||
test('looseboard saves split contacts and both local minute times without obsolete fields', async () => {
|
||||
const current = transportHarness('looseboard', true)
|
||||
Object.assign(current.form, { originContactName: 'A', originContactPhone: '1', destinationContactName: 'B', destinationContactPhone: '2', productName: '家居用品', estimatedPalletCount: 3, packageCount: 8, origin: 'LA', destination: 'ONT', pickupAt: '2026-10-20T09:00:00', deliveryAt: '2026-10-20T15:30:00' })
|
||||
await current.submit(); await current.submit()
|
||||
const payload = current.calls[1].payload
|
||||
assert.equal(payload.estimatedPalletCount, 3)
|
||||
assert.equal(payload.packageCount, 8)
|
||||
assert.equal(payload.productName, '家居用品')
|
||||
assert.equal(payload.pickupAt, '2026-10-20T09:00:00')
|
||||
assert.equal(payload.originContactName, 'A')
|
||||
assert.equal(payload.destinationContactPhone, '2')
|
||||
assert.equal(payload.deliveryAt, '2026-10-20T15:30:00')
|
||||
assert.equal(payload.idempotencyKey, current.calls[0].payload.idempotencyKey)
|
||||
for (const field of ['palletRequired', 'transportType', 'transportMode', 'containerType', 'contactName', 'contactInfo', 'requestedDate']) assert.equal(Object.hasOwn(payload, field), false)
|
||||
})
|
||||
|
||||
test('looseboard requires both times and rejects backwards schedule', () => {
|
||||
const current = transportHarness('looseboard')
|
||||
assert.equal(current.rules.value.pickupAt[0].required, true)
|
||||
assert.equal(current.rules.value.deliveryAt[0].required, true)
|
||||
let failure
|
||||
current.form.pickupAt = '2026-10-20T10:30:00'
|
||||
current.rules.value.deliveryAt[1].validator({}, '2026-10-20T10:29:00', error => { failure = error })
|
||||
assert.ok(failure)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user