This commit is contained in:
2026-08-18 11:32:58 +08:00
parent 771ed6f059
commit eedaa2f080
8 changed files with 109 additions and 17 deletions
@@ -26,6 +26,7 @@ test('maps the first-leg aggregate list fields without loading detail rows', ()
test('declares the documented merchant warehouse and first-leg endpoints', () => {
assert.match(apiSource, /url: '\/merchant\/v1\/warehouses'/)
assert.match(apiSource, /url: '\/merchant\/v1\/orders\/first-leg'/)
assert.match(apiSource, /url: '\/merchant\/v1\/orders\/first-leg\/inbound-code-policy'/)
assert.match(apiSource, /url: '\/merchant\/v1\/orders\/first-leg\/batch'/)
assert.match(apiSource, /`\/merchant\/v1\/orders\/first-leg\/\$\{id\}`/)
assert.match(apiSource, /`\/merchant\/v1\/orders\/first-leg\/\$\{id\}\/submit`/)
@@ -118,6 +119,10 @@ test('maps C02 authoritative status, transport, cargo and pickup snapshots', ()
assert.match(storeSource, /customerRemark: summary\.customerRemark \?\? ''/)
})
test('sends a manually entered old-system inbound code with the draft payload', () => {
assert.match(storeSource, /inboundCode: draft\.inboundCode\?\.trim\(\) \|\| undefined/)
})
test('sends backend-required channel, pricing, customs, destination and cargo fields', () => {
for (const field of ['pickupMethod', 'channelCode', 'channelName', 'pricingTaxMode', 'taxMode', 'customsInspection', 'destinationType', 'packageType']) {
assert.match(storeSource, new RegExp(field))
@@ -103,6 +103,7 @@ function savePayload(draft: FirstLegOrderDraft, warehouse: ClientWarehouse, cust
})
: undefined
return {
inboundCode: draft.inboundCode?.trim() || undefined,
customerName: customerName.trim(),
transportMode: apiTransport(draft),
tradeTerm: draft.tradeTerm || undefined,