fix(acceptance): select booking agents by carrier

This commit is contained in:
2026-09-02 16:38:44 +08:00
parent 1b1f2718b3
commit a8c71fef12
5 changed files with 35 additions and 17 deletions
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { oceanBookingDraft, oceanBookingDraftWithoutCustomer, publishPlatformLogisticsChannels, resolveOceanBookingMaster } from './ocean-booking-fixture.mjs'
import { oceanBookingDraft, oceanBookingDraftWithoutCustomer, publishPlatformLogisticsChannels, resolveOceanBookingAgent, resolveOceanBookingMaster } from './ocean-booking-fixture.mjs'
const read = (name) => readFileSync(new URL(name, import.meta.url), 'utf8')
const master = { customerId: '21', customerName: 'IT 测试客户', channelCode: 'SEA-US', channelName: '美西海运', warehouseId: '41', warehouseName: '深圳仓' }
@@ -68,6 +68,16 @@ test('platform channel producer uses the selected origin warehouse and publishes
assert.deepEqual(context.createdResources.platformLogisticsChannels, catalog)
})
test('booking agent fixture uses the carrier-filtered server candidates', async () => {
const calls = []
const context = { request: async (method, path) => {
calls.push({ method, path }); return { body: { code: '200', data: [{ supplierId: 81, name: 'MATSON 代理' }] } }
}, apiSuccess: (_module, _name, response) => response.body.data,
assert: (_module, _name, _response, condition) => assert.equal(condition, true) }
assert.deepEqual(await resolveOceanBookingAgent(context, 'test', 'matson'), { id: '81', name: 'MATSON 代理' })
assert.deepEqual(calls, [{ method: 'GET', path: '/api/platform/v1/ocean-bookings/booking-agents?carrierCode=MATSON' }])
})
test('all production booking fixtures use DRAFT release and the shared requirements contract', () => {
for (const name of ['ocean-bookings.mjs', 'phase3-loading.mjs', 'phase3-container-loading.mjs', 'phase3-order-splitting.mjs', 'manual-state-loading-pda.mjs', 'manual-state-ocean-trucking.mjs']) {
const source = read(name)