fix(test): assign authenticated PDA operator in pallet matrix

This commit is contained in:
2026-09-30 12:22:47 +08:00
parent 4a14001a09
commit 2f0b202590
2 changed files with 13 additions and 1 deletions
@@ -5,6 +5,13 @@ import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
import { sameOutboundTask } from './dropship-pallet-matrix.mjs'
import { receivingProgressMatches, outboundCandidateGuards, probePartialPick } from './dropship-outbound-edge-cases.mjs'
test('loading confirmation assigns the authenticated PDA operator from the target warehouse', () => {
const source = readFileSync(new URL('./dropship-pallet-matrix.mjs', import.meta.url), 'utf8')
assert.match(source, /domestic-pda-operators\?warehouseId=\$\{summary\.warehouseId\}/)
assert.match(source, /selectSessionPdaOperator\(operators, context\.pdaToken\)/)
assert.match(source, /assigneeId: String\(operator\.userId\)/)
})
test('receiving verifier follows three independent inbound codes through interleaved progress', () => {
const expected = [{ inboundCode: 'FBA', total: 5, received: 0 },
{ inboundCode: 'DROPSHIP', total: 4, received: 0 }, { inboundCode: 'OVERSEAS', total: 3, received: 0 }]
@@ -14,6 +14,7 @@ import { resolvePickerAccess, createPicker, disablePicker, uploadPhotos } from '
import { receivingProgressMatches, outboundCandidateGuards, outboundCreationGuards, outboundTaskGuards, probePartialPick } from './dropship-outbound-edge-cases.mjs'
import { receiveMixedContainer } from './mixed-container-receiving.mjs'
import { exerciseOldCabinets } from './pda-loading-link-regression.mjs'
import { selectSessionPdaOperator } from './domestic-pda-operator.mjs'
const MODULE = 'dropship-pallet-matrix'
const BASE = '/api/platform/v1/first-leg/pda-dropship'
@@ -274,8 +275,12 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
const loadingDetail = await command('读取整份预装确认门禁', 'GET',
`/api/platform/v1/first-leg/loading-plans/${plan.id}?warehouseId=${summary.warehouseId}`)
check(`${label}全部成员可以确认预装`, null, loadingDetail.summary?.readiness?.canConfirm === true)
const operators = await command('查询当前仓国内PDA作业员', 'GET',
`/api/platform/v1/iam/users/domestic-pda-operators?warehouseId=${summary.warehouseId}`)
const operator = selectSessionPdaOperator(operators, context.pdaToken)
const confirmed = await command('确认整份预装', 'POST', `/api/platform/v1/first-leg/loading-plans/${plan.id}/confirm`,
{ expectedVersion: Number(loadingDetail.summary.version) }, { 'Idempotency-Key': `${context.marker}-confirm` })
{ expectedVersion: Number(loadingDetail.summary.version), assigneeId: String(operator.userId) },
{ 'Idempotency-Key': `${context.marker}-confirm` })
const taskId = String(confirmed.readiness.pdaTaskId)
const pda = `/api/platform/v1/first-leg/pda-loading/tasks/${taskId}`
const task = await command('读取装柜PDA任务', 'GET', `${pda}?warehouseId=${summary.warehouseId}`)