test: complete phase4 PDA shipping prerequisites
This commit is contained in:
@@ -81,7 +81,7 @@ test('measurement and loading pass destination identity into the LOADED producer
|
||||
assert.match(finalize, /resourceKey: `\$\{context\.marker\}:\$\{fixture\.destinationType \|\| 'UNKNOWN'\}:\$\{fixture\.containerNo \|\| containerBookingId\}`/)
|
||||
assert.match(finalize, /phase4InboundProducerFixtures = collectPhase4InboundProducerFixture/)
|
||||
const entry = read('../admin-test-env-acceptance.mjs')
|
||||
assert.match(entry, /runPhase4ProducerVariant\('DROPSHIP-PRIMARY', 'FBA', 'ONE_CLICK_DROPSHIP'\)/)
|
||||
assert.match(entry, /runPhase4ProducerVariant\('DROPSHIP-PRIMARY', 'FBA', 'ONE_CLICK_DROPSHIP', true\)/)
|
||||
assert.match(entry, /orderFulfillmentType/)
|
||||
assert.match(entry, /fulfillmentType: fixtureOrder\.fulfillmentType \|\| 'STANDARD'/)
|
||||
assert.match(entry, /skuCodes: Array\.isArray\(fixtureOrder\.skuCodes\) \? fixtureOrder\.skuCodes : \[\]/)
|
||||
@@ -90,3 +90,35 @@ test('measurement and loading pass destination identity into the LOADED producer
|
||||
assert.match(pda, /find\(\(item\) => item\?\.fulfillmentType === 'ONE_CLICK_DROPSHIP'\)/)
|
||||
assert.match(pda, /skuFixtures\(context, producer\)/)
|
||||
})
|
||||
|
||||
test('only PDA-operated variants traverse real outbound and carrier nodes before overseas receiving', () => {
|
||||
const entry = read('../admin-test-env-acceptance.mjs')
|
||||
assert.match(entry, /runPhase4ProducerVariant\('OVERSEAS-PRIMARY', 'OVERSEAS', 'STANDARD', true\)/)
|
||||
assert.match(entry, /runPhase4ProducerVariant\('FBA-STANDARD', 'FBA', 'STANDARD', false\)/)
|
||||
assert.match(entry, /runPhase4ProducerVariant\('SECONDARY', 'FBA', 'STANDARD', false\)/)
|
||||
const start = entry.indexOf('if (pickupRequired && producerKey)')
|
||||
const end = entry.indexOf('} finally {', start)
|
||||
const pickupChain = entry.slice(start, end)
|
||||
const ordered = [
|
||||
'phase3-customs.mjs', 'service-center-flow.mjs', 'phase3-port-schedules.mjs',
|
||||
'phase3-outbound-dispatch.mjs', 'phase3-carrier-schedule-queries.mjs',
|
||||
'phase4-carrier-nodes.mjs', 'runUntilPickupReady(this)',
|
||||
]
|
||||
let cursor = -1
|
||||
for (const token of ordered) {
|
||||
const next = pickupChain.indexOf(token)
|
||||
assert.ok(next > cursor, `${token} must follow the real prerequisite chain`)
|
||||
cursor = next
|
||||
}
|
||||
for (const key of ['phase3Customs', 'serviceCenterFlow', 'portSchedule', 'phase3OutboundDispatch',
|
||||
'phase3CarrierScheduleQuery', 'phase4CarrierPickupReady']) assert.match(entry, new RegExp(`'${key}'`))
|
||||
assert.match(pickupChain, /shippingReady/)
|
||||
assert.match(entry, /carrierScheduleQueryId/)
|
||||
assert.match(pickupChain, /pickup\?\.marker === variantMarker/)
|
||||
assert.doesNotMatch(pickupChain, /internal\/event-bridge|ll_container_shipping_gate|requestOverseas/)
|
||||
assert.match(entry, /dropshipReady\?\.shippingReady === true/)
|
||||
assert.match(entry, /overseasReady\?\.shippingReady === true/)
|
||||
assert.match(entry, /awaitingVariants\.length >= 1/)
|
||||
assert.doesNotMatch(entry, /awaitingVariants\.length === 2/)
|
||||
assert.match(entry, /awaitingVariants\.every\(\(item\) => item\.shippingReady === false/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user