优化
This commit is contained in:
@@ -5,7 +5,10 @@ import test from 'node:test'
|
||||
import {
|
||||
confirmedNetSummary,
|
||||
normalizedGrossKg,
|
||||
palletOptionsPath,
|
||||
selectWeightPallet,
|
||||
WEIGHT_PALLET_OPTIONS_PAGE_SIZE,
|
||||
weightPalletOptionRecords,
|
||||
workspaceWeightMatchesBaseline,
|
||||
} from './inbound-weight-ocr.mjs'
|
||||
|
||||
@@ -42,7 +45,15 @@ test('cleanup restores a non-empty carton fallback when there were no confirmed
|
||||
|
||||
test('HTTP scenario uses pallet option and net weight contracts without legacy final weight', () => {
|
||||
const source = readFileSync(new URL('inbound-weight-ocr.mjs', import.meta.url), 'utf8')
|
||||
assert.match(source, /\/weight-pallet-options\?tenantId=/)
|
||||
const optionsPath = palletOptionsPath('10001', '20001', ' TP-09 ')
|
||||
assert.match(optionsPath, /\/weight-pallet-options\?tenantId=10001&(?:page=1&size=50|size=50&page=1)/)
|
||||
assert.match(optionsPath, /keyword=TP-09/)
|
||||
assert.equal(WEIGHT_PALLET_OPTIONS_PAGE_SIZE, 50)
|
||||
assert.deepEqual(weightPalletOptionRecords({
|
||||
records: [{ palletId: '1' }], page: 1, size: 50, total: 1000, pages: 20,
|
||||
}), [{ palletId: '1' }])
|
||||
assert.equal(weightPalletOptionRecords([{ palletId: '1' }]), null)
|
||||
assert.equal(weightPalletOptionRecords({ records: [], page: 1, size: 1000 }), null)
|
||||
assert.ok(source.indexOf('const palletOptionsResponse') < source.lastIndexOf('const uploadPath'))
|
||||
assert.match(source, /form\.append\('file'/)
|
||||
assert.doesNotMatch(source, /form\.append\('palletId'/)
|
||||
|
||||
Reference in New Issue
Block a user