Merge test into dev and resolve conflicts

This commit is contained in:
2026-09-14 11:02:37 +08:00
342 changed files with 8454 additions and 1591 deletions
@@ -5,7 +5,7 @@ import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
import { auxiliaryPalletFbaWarehouseCode, run } from './phase4-overseas-pda-operations.mjs'
import { run } from './phase4-overseas-pda-operations.mjs'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'phase4-overseas-pda-operations.mjs'), 'utf8')
@@ -29,6 +29,8 @@ test('receiving hands off only transient credentials and completed warehouse fac
assert.match(receivingSource, /context\.context\.phase4OverseasPdaOperations = \{/)
assert.match(receivingSource, /completedFixtures: \[\]/)
assert.match(receivingSource, /merchantToken,/)
assert.match(receivingSource, /const refreshedMerchantToken = await loginMerchantForNegativeProbe\(context\)/)
assert.match(receivingSource, /phase4OverseasPdaOperations\.merchantToken = refreshedMerchantToken/)
assert.match(receivingSource, /if \(!handoffReady\) \{[\s\S]*await cleanup\(\)/)
assert.doesNotMatch(receivingSource, /createdResources\.phase4OverseasPdaOperations/)
assert.doesNotMatch(receivingSource, /primary: primary \? \{[^}]*password/)
@@ -66,16 +68,25 @@ test('P2 to P5 cover all frozen endpoints, replays and conflict boundaries witho
assert.match(source, /traceId=/)
})
test('auxiliary pallets use the authoritative inbound FBA code and never the business destination fallback', () => {
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ' ABE3 '), 'ABE3')
assert.equal(auxiliaryPalletFbaWarehouseCode('OVERSEAS', 'ABE3'), null)
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ''), null)
test('PDA operations reuse received plan pallets and the public location without creating resources', () => {
assert.match(receivingSource,
/destinationType: inbound\.destinationType,[\s\S]*fbaWarehouseCode: inbound\.destinationType === 'FBA' \? inbound\.fbaWarehouseCode : null/)
assert.match(source, /fbaWarehouseCode,\s*\n\s*remark:/)
assert.match(source, /createLocation\(context, fixture\.overseasWarehouseId, `\$\{suffix\}-PALLET`\)/)
assert.match(source, /locationId: location\.locationId/)
assert.doesNotMatch(source, /createEmptyPallet\([^\n]*main\.destinationWarehouseCode/)
/auxiliaryPallets: generatedContainerPallets\.filter/)
assert.match(source, /resolvePublicLocation/)
assert.match(source, /resolveReusableAuxiliaryPallet/)
assert.match(source, /locationType === 'VIRTUAL'/)
assert.match(source, /P3托盘已在公共库位不重复移库/)
assert.doesNotMatch(source, /warehouse-admin[^'`]*\/locations`,\s*\{/)
assert.doesNotMatch(source, /warehouse-admin[^'`]*\/pallets`,\s*\{/)
assert.doesNotMatch(source, /createLocation|createEmptyPallet/)
})
test('P5 follows warehouse review, customer confirmation and fulfillment completion in order', () => {
assert.match(source, /applicationStatus === 'CUSTOMER_CONFIRM_PENDING'/)
assert.match(source, /const merchantRelabelBase = '\/api\/merchant\/v1\/last-leg\/relabel-applications'/)
assert.match(source, /`\$\{merchantRelabelBase\}\/\$\{encodeURIComponent\(relabelNo\)\}\/confirm-completion`/)
assert.match(source, /status === 'READY_FOR_OUTBOUND'/)
assert.match(source, /status: 'COMPLETED'/)
assert.match(source, /walletStatus === 'SETTLED'/)
})
test('fixture failure still disables both picker accounts and removes all transient tokens', async () => {