fix: align HTTP acceptance fixtures and pallet permissions

This commit is contained in:
2026-09-14 12:40:40 +08:00
parent e55ab73e61
commit a2ea0ba9e6
15 changed files with 205 additions and 50 deletions
@@ -10,6 +10,10 @@ const PNG = Uint8Array.from(Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC
function id(value) { return value == null ? '' : String(value) }
function longId(value) { return /^\d+$/.test(id(value)) && id(value) !== '0' }
function nonBlank(value) { return typeof value === 'string' && value.trim().length > 0 }
export function uniqueContainerProducer(item, index, all) {
return nonBlank(item?.containerNo)
&& all.findIndex((candidate) => candidate?.containerNo === item.containerNo) === index
}
function success(response) { return response?.http === 200 && String(response?.body?.code) === '200' }
function code(response) { return String(response?.body?.code ?? '') }
function traced(response) { return nonBlank(response?.requestId) && nonBlank(response?.traceId) }
@@ -897,9 +901,9 @@ export async function run(context) {
const standardFba = matrix?.byDestinationType?.FBA?.find((item) => item?.fulfillmentType !== 'ONE_CLICK_DROPSHIP')
// The sealed dropship pallet proves the indivisible handover. A separate standard FBA
// fixture supplies multiple cartons for reversible split/merge/unbind and relabel checks.
const producers = [dropship || matrix?.byDestinationType?.FBA?.[0], standardFba,
const producers = [dropship, standardFba,
matrix?.byDestinationType?.OVERSEAS?.[0]]
.filter((item) => nonBlank(item?.containerNo))
.filter(uniqueContainerProducer)
const allProducers = Array.isArray(matrix?.containers) ? matrix.containers : producers
if (allProducers.length) await awaitProducerConsumption(context, allProducers)
if (producers.length && !(await convertReceivingContainers(context, producers))) {