test: map PDA fixtures by completed container
This commit is contained in:
@@ -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/)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user