This commit is contained in:
2026-09-09 09:52:46 +08:00
parent 68a5612598
commit 4379b721bc
9 changed files with 195 additions and 46 deletions
@@ -60,6 +60,7 @@ test('builds an order payload owned by the fixed profile', () => {
senderLocation: { province: '浙江省', city: '义乌市', district: '稠城街道', postalCode: '322000' },
},
productImageFileId: '33',
pickupAddressId: '55',
})
assert.equal(payload.receivingWarehouseId, '11')
assert.equal(payload.destinationWarehouseId, '22')
@@ -67,11 +68,14 @@ test('builds an order payload owned by the fixed profile', () => {
assert.equal(payload.customerName, '固定测试客户')
assert.equal(payload.cargoes.length, 1)
assert.equal(payload.cargoes[0].productImageFileId, '33')
assert.equal(payload.cargoes[0].woodenProduct, false)
assert.equal(payload.tradeTerm, 'EXW')
assert.equal(payload.pickupMethod, 'SELF_TRUCK')
assert.equal(payload.taxMode, 'TAX_REFUND')
assert.equal(payload.customsInspection, true)
assert.equal(payload.sender, null)
assert.equal(payload.senderAddressId, null)
assert.equal(payload.requestedPickupAt, null)
assert.equal(payload.cargoes[0].cargoName, PRODUCT_CATALOG[0].cargoName)
assert.equal(payload.cargoes[0].packageCount, 7)
assert.equal(payload.cargoes[0].totalQuantity, PRODUCT_CATALOG[0].unitsPerPackage * 7)
@@ -79,6 +83,27 @@ test('builds an order payload owned by the fixed profile', () => {
assert.equal(payload.cargoes[0].declaredValue, PRODUCT_CATALOG[0].unitDeclaredValue * PRODUCT_CATALOG[0].unitsPerPackage * 7)
})
test('uses the selected customer pickup address and appointment for pickup orders', () => {
const payload = buildOrderPayload({
marker: 'PENDING-PICKUP', index: 1,
profile: { id: '44', tenantName: '固定测试客户' },
master: {
receiving: { id: '11', warehouseName: '国内仓' },
destination: { id: '22', warehouseName: 'ONT8', warehouseCode: 'ONT8', countryCode: 'US' },
channel: { channelCode: 'SEA-US', channelName: '美西海运' }, pricingTaxMode: 'TAX_INCLUDED',
},
product: PRODUCT_CATALOG[0], packageCount: 1, productImageFileId: '33', pickupAddressId: '55',
options: {
tradeTerm: 'FOB', pickupMethod: 'PICKUP', taxMode: 'BUY_DECLARATION',
customsInspection: false, expectedShipDays: 7,
senderLocation: { province: '广东省', city: '深圳市', district: '南山区', postalCode: '518000' },
},
})
assert.equal(payload.sender, null)
assert.equal(payload.senderAddressId, '55')
assert.match(payload.requestedPickupAt, /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)
})
test('randomizes only supported basic-order fields', () => {
for (let index = 0; index < 100; index += 1) {
const options = randomOrderOptions()