test: isolate overseas PDA operations fixture

This commit is contained in:
2026-09-24 05:08:46 +08:00
parent eb8662070a
commit 8f1fafe572
6 changed files with 18 additions and 3 deletions
+8
View File
@@ -1633,6 +1633,11 @@ export class AcceptanceRun {
if (!hasSecondStandardFbaProducer()) {
await this.runPhase4ProducerVariant('FBA-SECOND', 'FBA', 'STANDARD', true)
}
const hasOperationsFbaProducer = () => (this.createdResources.phase4InboundProducerFixtures?.containers || [])
.some((item) => /-P4-FBA-OPERATIONS(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
if (!hasOperationsFbaProducer()) {
await this.runPhase4ProducerVariant('FBA-OPERATIONS', 'FBA', 'STANDARD', true)
}
if (Number(readiness().overseasContainerCount || 0) < 1) {
await this.runPhase4ProducerVariant('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true)
}
@@ -1650,12 +1655,15 @@ export class AcceptanceRun {
const overseasReady = containers.find((item) => item?.destinationType === 'OVERSEAS')
const secondStandardFbaReady = containers.find((item) =>
/-P4-FBA-SECOND(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
const operationsFbaReady = containers.find((item) =>
/-P4-FBA-OPERATIONS(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
const awaitingVariants = containers.filter((item) => ['SECONDARY']
.some((label) => new RegExp(`-P4-${label}(?:-R\\d+)?:`).test(String(item?.resourceKey || ''))))
const shippingMatrixReady = dropshipReady?.shippingReady === true
&& Boolean(dropshipReady?.carrierScheduleQueryId)
&& standardFbaReady?.shippingReady === true && Boolean(standardFbaReady?.carrierScheduleQueryId)
&& secondStandardFbaReady?.shippingReady === true && Boolean(secondStandardFbaReady?.carrierScheduleQueryId)
&& operationsFbaReady?.shippingReady === true && Boolean(operationsFbaReady?.carrierScheduleQueryId)
&& overseasReady?.shippingReady === true && Boolean(overseasReady?.carrierScheduleQueryId)
&& awaitingVariants.length >= 1
&& awaitingVariants.every((item) => item.shippingReady === false
@@ -130,6 +130,7 @@ test('only PDA-operated variants traverse real outbound and carrier nodes before
assert.match(entry, /runPhase4ProducerVariant\('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true\)/)
assert.match(entry, /runPhase4ProducerVariant\('FBA-STANDARD', 'FBA', 'STANDARD', true\)/)
assert.match(entry, /runPhase4ProducerVariant\('FBA-SECOND', 'FBA', 'STANDARD', true\)/)
assert.match(entry, /runPhase4ProducerVariant\('FBA-OPERATIONS', 'FBA', 'STANDARD', true\)/)
assert.match(entry, /secondStandardFbaReady\?\.shippingReady === true/)
assert.match(entry, /runPhase4ProducerVariant\('SECONDARY', 'FBA', 'STANDARD', false\)/)
assert.match(entry, /const hasSecondaryProducer =/)
@@ -152,7 +152,8 @@ test('PDA module covers the container-number receiving contract and excludes out
assert.match(source, /generatedPalletsByInbound/)
assert.match(source, /standardFbaProducers = \(Array\.isArray\(matrix\?\.containers\) \? matrix\.containers : \[\]\)/)
assert.match(source, /item\?\.fulfillmentType !== 'ONE_CLICK_DROPSHIP'/)
assert.match(source, /\.slice\(0, 2\)/)
assert.match(source, /FBA-OPERATIONS/)
assert.match(source, /\.slice\(0, 3\)/)
assert.match(source, /const producers = \[dropship, \.\.\.standardFbaProducers,/)
assert.doesNotMatch(source, /创建当前柜实收托盘|创建当前柜实收库位|async function createPallet/)
assert.match(source, /retained as acceptance evidence/)
@@ -757,6 +757,10 @@ export async function run(context) {
// ABE8 producer untouched when the matrix contains both destinations so the
// following dispatch module can still observe RECEIVED candidates for ABE4+ABE8.
const fixture = fixturesByAuxiliaryCapacity.find((item) => item?.destinationType === 'FBA'
&& /-P4-FBA-OPERATIONS(?:-R\d+)?:/.test(String(item?.resourceKey || ''))
&& (item?.auxiliaryPallets?.length || 0) > 0 && Array.isArray(item?.inventory)
&& item.inventory.reduce((sum, line) => sum + Number(line?.availablePackages || 0), 0) > 3)
|| fixturesByAuxiliaryCapacity.find((item) => item?.destinationType === 'FBA'
&& item?.fbaWarehouseCode === 'ABE4'
&& (item?.auxiliaryPallets?.length || 0) > 0 && Array.isArray(item?.inventory)
&& item.inventory.reduce((sum, line) => sum + Number(line?.availablePackages || 0), 0) > 3)
@@ -935,9 +935,9 @@ export async function run(context) {
const standardFbaProducers = (Array.isArray(matrix?.containers) ? matrix.containers : [])
.filter((item) => item?.destinationType === 'FBA')
.filter((item) => item?.fulfillmentType !== 'ONE_CLICK_DROPSHIP')
.filter((item) => /-P4-(?:FBA-STANDARD|FBA-SECOND)(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
.filter((item) => /-P4-(?:FBA-STANDARD|FBA-SECOND|FBA-OPERATIONS)(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
.sort((left, right) => String(left?.resourceKey).localeCompare(String(right?.resourceKey)))
.slice(0, 2)
.slice(0, 3)
// The sealed dropship pallet proves the indivisible handover. A separate standard FBA
// fixture supplies multiple cartons for reversible operations. The second standard FBA
// fixture remains available for the multi-destination dispatch and delivery split proof.
@@ -176,6 +176,7 @@ test('PDA entry expands the real phase-three producer chain and builds an FBA/OV
assert.match(source, /runPhase4ProducerVariant\('DROPSHIP-PRIMARY', 'FBA', 'ONE_CLICK_DROPSHIP', true\)/)
assert.match(source, /runPhase4ProducerVariant\('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true\)/)
assert.match(source, /runPhase4ProducerVariant\('FBA-STANDARD', 'FBA', 'STANDARD', true\)/)
assert.match(source, /runPhase4ProducerVariant\('FBA-OPERATIONS', 'FBA', 'STANDARD', true\)/)
assert.match(source, /-P4-FBA-STANDARD\(\?:-R\\d\+\)\?:/)
assert.match(source, /runPhase4ProducerVariant\('SECONDARY', 'FBA', 'STANDARD', false\)/)
assert.match(source, /runUntilPickupReady\(this\)/)