From 66c2651be72be5b45f8a502be0b60bb768ae3b91 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Thu, 24 Sep 2026 05:53:55 +0800 Subject: [PATCH] test: map PDA fixtures by completed container --- .../phase4-overseas-pda-operations-contract.test.mjs | 1 + scripts/admin-test-env-modules/phase4-overseas-pda.mjs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/admin-test-env-modules/phase4-overseas-pda-operations-contract.test.mjs b/scripts/admin-test-env-modules/phase4-overseas-pda-operations-contract.test.mjs index e8ac2209a..71222f3d5 100644 --- a/scripts/admin-test-env-modules/phase4-overseas-pda-operations-contract.test.mjs +++ b/scripts/admin-test-env-modules/phase4-overseas-pda-operations-contract.test.mjs @@ -47,6 +47,7 @@ test('PDA operations run immediately after receiving and all later consumers dep test('receiving hands off only transient credentials and completed warehouse facts', () => { assert.match(receivingSource, /context\.context\.phase4OverseasPdaOperations = \{/) assert.match(receivingSource, /completedFixtures: \[\]/) + assert.match(receivingSource, /resourceKey: producerFixture\?\.resourceKey \|\| null/) assert.match(receivingSource, /merchantToken,/) assert.match(receivingSource, /const refreshedMerchantToken = await loginMerchantForNegativeProbe\(context\)/) assert.match(receivingSource, /phase4OverseasPdaOperations\.merchantToken = refreshedMerchantToken/) diff --git a/scripts/admin-test-env-modules/phase4-overseas-pda.mjs b/scripts/admin-test-env-modules/phase4-overseas-pda.mjs index 813ec4d63..3702cf39e 100644 --- a/scripts/admin-test-env-modules/phase4-overseas-pda.mjs +++ b/scripts/admin-test-env-modules/phase4-overseas-pda.mjs @@ -858,12 +858,16 @@ async function runReceiving(context, token, secondaryToken, merchantToken, prefe context.createdResources.phase4OverseasPda.generatedPalletsByInbound[item.inboundCode] || []) const completedFixtures = [] const order = await captureCompletedOrder(context, containerNo, preferredProducer?.tenantId) + const producerFixtures = (context.createdResources?.phase4InboundProducerFixtures?.containers || []) + .filter((item) => id(item?.containerNo) === id(containerNo)) for (const inbound of current.data.inbounds.filter((item) => pallets.has(item.inboundCode))) { const warehouseFacts = await verifyWarehouseQueries(context, token, inbound.inboundCode, pallets.get(inbound.inboundCode), inbound.destinationType) if (warehouseFacts && context.context?.phase4OverseasPdaOperations) { - const producerFixture = (context.createdResources?.phase4InboundProducerFixtures?.containers || []) - .find((item) => id(item?.inboundCode) === id(inbound.inboundCode)) + const producerFixture = producerFixtures.find((item) => id(item?.inboundCode) === id(inbound.inboundCode)) + || producerFixtures.find((item) => item?.destinationType === inbound.destinationType + && id(item?.destinationWarehouseCode) === id(inbound?.fbaWarehouseCode)) + || producerFixtures.find((item) => item?.destinationType === inbound.destinationType) const fixture = { containerNo, order, destinationType: inbound.destinationType, fbaWarehouseCode: inbound.destinationType === 'FBA' ? inbound.fbaWarehouseCode : null,