test(firstleg): harden pallet option page contract

This commit is contained in:
2026-09-01 11:03:40 +08:00
parent 7ace1ded56
commit 4991536065
6 changed files with 57 additions and 8 deletions
@@ -7,6 +7,7 @@ const read = (relativeUrl) => readFileSync(new URL(relativeUrl, import.meta.url)
const controller = read('../../firstleg/src/main/java/com/baiyue/firstleg/controller/PlatformInboundMeasurementController.java')
const service = read('../../firstleg/src/main/java/com/baiyue/firstleg/service/InboundMeasurementService.java')
const warehouseClient = read('../../firstleg/src/main/java/com/baiyue/firstleg/client/WarehousePalletLocationClient.java')
const serviceTests = read('../../firstleg/src/test/java/com/baiyue/firstleg/service/InboundMeasurementServiceTest.java')
const openapi = read('../../firstleg/src/main/resources/openapi/firstleg-v1.yaml')
const adminApi = read('../../../apps/admin-web/src/modules/inbounds/weight/api/weightOcr.ts')
const adminPanel = read('../../../apps/admin-web/src/modules/inbounds/weight/components/WeightOcrPanel.vue')
@@ -112,3 +113,16 @@ test('historical pallet snapshot remains read-only visible when it is no longer
assert.match(cards, /row\.palletTareWeightKg/)
assert.match(adminBehavior, /(?:historical|history|历史|失去候选|no longer eligible).{0,220}(?:palletCode|托盘编码|TP-)/is)
})
test('backend detail reads the stored historical pallet snapshot without revalidating current eligibility', () => {
assert.match(serviceTests, /detailUsesStoredPalletSnapshotAfterCandidateBecomesUnavailable/)
assert.match(serviceTests, /verify\(warehousePallets, never\(\)\)\.palletSnapshot/)
assert.match(serviceTests, /verify\(warehousePallets, never\(\)\)\.palletSnapshots/)
})
test('backend evidence fails closed for Warehouse non-2xx and network errors', () => {
assert.match(serviceTests, /weightPalletOptionsFailsClosedOnWarehouseNon2xxResponse/)
assert.match(serviceTests, /weightPalletOptionsFailsClosedOnWarehouseNetworkError/)
assert.match(serviceTests, /FeignException/)
assert.match(serviceTests, /RetryableException/)
})