fix(acceptance): reuse initialized pallet fixtures

This commit is contained in:
2026-09-10 20:47:15 +08:00
parent 69e80a736e
commit 47a70406f6
12 changed files with 65 additions and 95 deletions
@@ -3,6 +3,7 @@ import { diffPushPreloadStability, projectPushPreloadStability } from './push-pr
import { containerFieldGaps, loadingListFieldGaps, preloadFieldGaps } from './fulfillment-list-field-contract.mjs'
import { ensureMatsonCarrierPartner } from './carrier-partner-fixture.mjs'
import { iso6346ContainerNumber } from './iso6346-container-number.mjs'
import { channelGroup } from './smart-loading-channel-group.mjs'
const MODULE = 'phase3-container-loading'
const OPTIONS = { scenario: 'phase3-container-smart-loading-pda', deploymentBlocker: true }
@@ -208,7 +209,7 @@ export async function run(context) {
context.assert(MODULE, '订舱渠道与仓库快照完整', inboundResponse, Boolean(channelCode && channelName && warehouseName),
`channelCode=${channelCode || 'missing'}, warehouseId=${warehouseId}, warehouseName=${warehouseName || 'missing'}`, OPTIONS)
const simulationResponse = await request(context, 'POST', CONTAINERS, {
channelCode, warehouseId, containerType: primaryRequirement.containerType,
channelGroupCode: channelGroup(channelCode), warehouseId, containerType: primaryRequirement.containerType,
capacityCbm: primaryRequirement.capacityCbm, maxWeightKg: primaryRequirement.maxWeightKg,
})
const simulation = context.apiSuccess(MODULE, '新增内部模拟柜', simulationResponse,
@@ -216,7 +217,8 @@ export async function run(context) {
const containerId = id(simulation?.id)
context.assert(MODULE, '模拟柜由服务端生成稳定身份且不伪造真实柜号或订舱', simulationResponse,
Boolean(containerId) && Boolean(simulation?.cabinetNo) && simulation?.containerNo == null
&& simulation?.oceanBookingId == null && simulation?.channelCode === channelCode
&& simulation?.oceanBookingId == null && simulation?.channelGroupCode === channelGroup(channelCode)
&& simulation?.channelCode == null
&& id(simulation?.warehouseId) === warehouseId,
`containerBookingId=${containerId || 'missing'}, cabinetNo=${simulation?.cabinetNo || 'missing'}, oceanBookingId=${id(simulation?.oceanBookingId) || 'null'}`, OPTIONS)
if (!containerId) return
@@ -240,7 +242,8 @@ export async function run(context) {
} else {
const foreignChannel = channelIsolation.pair.foreign
const foreignContainerResponse = await request(context, 'POST', CONTAINERS, {
channelCode: foreignChannel.channelCode, warehouseId, containerType: primaryRequirement.containerType,
channelGroupCode: channelGroup(foreignChannel.channelCode), warehouseId,
containerType: primaryRequirement.containerType,
capacityCbm: primaryRequirement.capacityCbm, maxWeightKg: primaryRequirement.maxWeightKg,
})
const foreignContainer = context.apiSuccess(MODULE, '新增真实异渠道模拟柜', foreignContainerResponse, '', OPTIONS)
@@ -288,9 +291,10 @@ export async function run(context) {
context.assert(MODULE, '货柜详情保留候选货物路线约束', containerDetailResponse,
(!containerDetail?.destinationWarehouseCode || !candidate.destinationWarehouseCode
|| containerDetail.destinationWarehouseCode === candidate.destinationWarehouseCode)
&& containerDetail?.channelCode === channelCode
&& containerDetail?.channelGroupCode === channelGroup(channelCode)
&& containerDetail?.channelCode == null
&& ['EDITING', 'WAIT_LOADING'].includes(containerDetail?.planStatus),
`planStatus=${containerDetail?.planStatus || 'missing'}, channel=${containerDetail?.channelCode || 'missing'}`, OPTIONS)
`planStatus=${containerDetail?.planStatus || 'missing'}, channelGroup=${containerDetail?.channelGroupCode || 'missing'}`, OPTIONS)
const containerNo = id(containerDetail?.containerNo || containerDetail?.cabinetNo)
const planResponse = await request(context, 'GET', `${SMART}/plans/by-booking/${encodeURIComponent(containerId)}`)
@@ -517,7 +521,7 @@ export async function run(context) {
`containerBookingId=${id(mergedContainer?.containerBookingId) || 'missing'}, requirementId=${id(mergedContainer?.requirementId) || 'missing'}, allocationId=${id(mergedContainer?.allocationId) || 'missing'}`, OPTIONS)
const duplicateSimulationResponse = await request(context, 'POST', CONTAINERS, {
channelCode, warehouseId, containerType: primaryRequirement.containerType,
channelGroupCode: channelGroup(channelCode), warehouseId, containerType: primaryRequirement.containerType,
capacityCbm: primaryRequirement.capacityCbm, maxWeightKg: primaryRequirement.maxWeightKg,
})
const duplicateSimulation = context.apiSuccess(MODULE, '新增重复容量占用负向模拟柜', duplicateSimulationResponse, '', OPTIONS)