From f041cf524bf739c75f8cad0524f9eeb5ec9b40d3 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Mon, 24 Aug 2026 13:57:02 +0800 Subject: [PATCH] test(phase3): complete remaining hard-gate fixtures --- .../manual-state-ocean-trucking-contract.test.mjs | 2 ++ .../manual-state-ocean-trucking.mjs | 13 +++++++++---- .../phase3-order-splitting.mjs | 8 ++++++++ .../phase3-producer-chain-contract.test.mjs | 2 +- .../admin-test-env-modules/service-center-flow.mjs | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/admin-test-env-modules/manual-state-ocean-trucking-contract.test.mjs b/scripts/admin-test-env-modules/manual-state-ocean-trucking-contract.test.mjs index 1caffde46..d6e88e869 100644 --- a/scripts/admin-test-env-modules/manual-state-ocean-trucking-contract.test.mjs +++ b/scripts/admin-test-env-modules/manual-state-ocean-trucking-contract.test.mjs @@ -18,4 +18,6 @@ test('truck matrix remains independent while retaining its own lifecycle', () => assert.match(source, new RegExp(`['\"]${status}['\"]`)) } assert.match(source, /page=1&size=100&status=/) + assert.match(source, /category=TRUCKING&status=ACTIVE/) + assert.match(source, /carrierId: id\(carrier\.id\), carrierName: carrier\.name/) }) diff --git a/scripts/admin-test-env-modules/manual-state-ocean-trucking.mjs b/scripts/admin-test-env-modules/manual-state-ocean-trucking.mjs index 57b62fb3d..d1b3f27df 100644 --- a/scripts/admin-test-env-modules/manual-state-ocean-trucking.mjs +++ b/scripts/admin-test-env-modules/manual-state-ocean-trucking.mjs @@ -69,13 +69,13 @@ async function buildOcean(context, template, status, index) { throw new Error(`unsupported ocean status ${status}`) } -function truckPayload(context, oceanBooking, index) { +function truckPayload(context, oceanBooking, carrier, index) { const value = suffix(context, index) return { outboundOrderId: null, oceanBookingId: oceanBooking.id, containerBookingId: null, loadingPlanId: null, warehouseId: oceanBooking.warehouseId, customerId: oceanBooking.customerId, - customerName: oceanBooking.customerName, - carrierId: null, carrierName: null, fleetContact: '人工验收联系人', fleetPhone: '13800000004', + customerName: null, + carrierId: id(carrier.id), carrierName: carrier.name, fleetContact: '人工验收联系人', fleetPhone: '13800000004', driverName: `人工司机-${value}`, driverPhone: '13800000005', vehicleNo: `粤B${value.slice(-6)}`, storeName: '人工验收仓', storeContact: '仓库联系人', storePhone: '13800000006', storeAddress: '深圳市南山区人工验收地址', storeCity: '深圳市', storeZipcode: '518000', @@ -85,7 +85,12 @@ function truckPayload(context, oceanBooking, index) { } async function createTruck(context, oceanBooking, index) { - const response = await context.request('POST', TRUCK_BASE, truckPayload(context, oceanBooking, index)) + const carrierResponse = await context.request('GET', + '/api/platform/v1/suppliers?tenantId=0&category=TRUCKING&status=ACTIVE&page=1&size=20') + const carrierPage = context.apiSuccess(MODULE, `读取拖车状态样本 ${index} 的 ACTIVE 承运商`, carrierResponse, '', OPTIONS) + const carrier = carrierPage?.records?.find?.((item) => item?.id && item?.name) + if (!carrier) throw new Error(`创建拖车样本 ${index} 缺少 ACTIVE 承运商`) + const response = await context.request('POST', TRUCK_BASE, truckPayload(context, oceanBooking, carrier, index)) const value = context.apiSuccess(MODULE, `创建拖车状态样本 ${index}`, response, '', OPTIONS) if (!value?.id) throw new Error(`创建拖车样本 ${index} 失败`) return value diff --git a/scripts/admin-test-env-modules/phase3-order-splitting.mjs b/scripts/admin-test-env-modules/phase3-order-splitting.mjs index 17ddc2da3..baf5e0a44 100644 --- a/scripts/admin-test-env-modules/phase3-order-splitting.mjs +++ b/scripts/admin-test-env-modules/phase3-order-splitting.mjs @@ -407,6 +407,14 @@ async function loadOneFragment(context, state) { `HTTP=${differentReplay.http}, code=${codeOf(differentReplay)}, requestId=${differentReplay.requestId || 'missing'}, traceId=${differentReplay.traceId || 'missing'}`, OPTIONS) } + const labelResponse = await context.requestBinary('POST', + `/api/platform/inbounds/${encodeURIComponent(id(candidate.inboundId))}/carton-label-pdf?tenantId=${encodeURIComponent(tenantId)}`) + context.assert(MODULE, `${sourceOrderNo} 完成前生成可交接箱唛池`, labelResponse, + labelResponse.http === 200 && String(labelResponse.contentType || '').toLowerCase().includes('pdf') + && Number(labelResponse.bytes?.length) > 0, + `HTTP=${labelResponse.http}, contentType=${labelResponse.contentType || 'missing'}, bytes=${labelResponse.bytes?.length ?? 0}`, OPTIONS) + if (labelResponse.http !== 200 || !Number(labelResponse.bytes?.length)) return null + if (!await ensureCompletionEvidence(context, tenantId, id(candidate.inboundId), operationBase)) return null const completePath = `${PDA}/tasks/${taskId}/complete` diff --git a/scripts/admin-test-env-modules/phase3-producer-chain-contract.test.mjs b/scripts/admin-test-env-modules/phase3-producer-chain-contract.test.mjs index 89534db99..6aa4e44af 100644 --- a/scripts/admin-test-env-modules/phase3-producer-chain-contract.test.mjs +++ b/scripts/admin-test-env-modules/phase3-producer-chain-contract.test.mjs @@ -499,7 +499,7 @@ test('downstream container consumers prefer the phase3Loading fixture', () => { assert.match(serviceCenter, /if \(!allocationMatches\) return/) assert.match(serviceCenter, /const customerName = String\(oceanDetail\?\.oceanBooking\?\.customerName \|\| ''\)\.trim\(\)/) assert.match(serviceCenter, /category=TRUCKING&status=ACTIVE/) - assert.match(serviceCenter, /customerId, customerName, carrierId: id\(carrier\.id\), carrierName: carrier\.name/) + assert.match(serviceCenter, /customerId, customerName: null, carrierId: id\(carrier\.id\), carrierName: carrier\.name/) assert.doesNotMatch(serviceCenter, /链路承运商-/) assert.doesNotMatch(serviceCenter, /customerName: `服务中心链路客户-/) const schedules = source('./phase3-port-schedules.mjs') diff --git a/scripts/admin-test-env-modules/service-center-flow.mjs b/scripts/admin-test-env-modules/service-center-flow.mjs index 14bc94830..f7a29b771 100644 --- a/scripts/admin-test-env-modules/service-center-flow.mjs +++ b/scripts/admin-test-env-modules/service-center-flow.mjs @@ -87,7 +87,7 @@ export async function run(context) { warehouseId: linkContainer ? id(containerFlow.warehouseId) : id(context.createdResources?.warehouse?.id || context.context?.warehouseId || '193000000000000001'), - customerId, customerName, carrierId: id(carrier.id), carrierName: carrier.name, + customerId, customerName: null, carrierId: id(carrier.id), carrierName: carrier.name, fleetContact: '链路车队联系人', fleetPhone: '13800000007', driverName: '链路司机', driverPhone: '13800000008', driverIdCard: null, vehicleNo: `粤D-${suffix.slice(-6)}`, storeName: `链路门店-${suffix}`, storeContact: '链路联系人', storePhone: '13800000009', storeAddress: '深圳市南山区链路地址', storeCity: '深圳市', storeZipcode: '518000',