test: retry transient unauthenticated upload probe

This commit is contained in:
2026-09-04 16:04:12 +08:00
parent e477f73983
commit b8a649e705
2 changed files with 25 additions and 1 deletions
@@ -4,6 +4,7 @@ import test from 'node:test'
import {
confirmedNetSummary,
isTransientGatewayFailure,
normalizeWeightPalletOptionPage,
normalizedGrossKg,
palletOptionsPath,
@@ -13,6 +14,15 @@ import {
workspaceWeightMatchesBaseline,
} from './inbound-weight-ocr.mjs'
test('retries only transient gateway failures for the unauthenticated upload probe', () => {
assert.equal(isTransientGatewayFailure({ http: 0 }), true)
assert.equal(isTransientGatewayFailure({ http: 502 }), true)
assert.equal(isTransientGatewayFailure({ http: 503 }), true)
assert.equal(isTransientGatewayFailure({ http: 401 }), false)
assert.equal(isTransientGatewayFailure({ http: 403 }), false)
assert.equal(isTransientGatewayFailure({ http: 500 }), false)
})
test('selects a stable complete pallet snapshot without status or availability', () => {
const selected = selectWeightPallet([
{ palletId: '20', palletCode: 'P-20', palletType: 'STANDARD', capacityCbm: 2, tareWeightKg: 18.5 },