This commit is contained in:
2026-08-12 09:26:00 +08:00
parent 64a8fcd130
commit 0b51ed4347
5 changed files with 32 additions and 17 deletions
+5 -5
View File
@@ -69,25 +69,25 @@ test('submitStates turns only pending items into skipped', () => {
})
})
test('classifyScan distinguishes pending, repeated, and unknown SKU codes', () => {
const scanItems = [{ id: 1, sku: 'EL-38201' }, { id: 2, sku: 'EL-38202' }]
test('classifyScan distinguishes pending, repeated, and unknown carton codes', () => {
const scanItems = [{ id: 1, boxCodes: ['BOX-001'] }, { id: 2, boxCodes: ['BOX-002', 'BOX-003'] }]
assert.deepEqual(state.classifyScan(scanItems, {
1: state.ITEM_STATUS.PICKED,
2: state.ITEM_STATUS.PENDING,
}, 'EL-38202'), {
}, 'BOX-002'), {
type: 'pending',
item: scanItems[1],
})
assert.deepEqual(state.classifyScan(scanItems, {
1: state.ITEM_STATUS.PARTIAL,
2: state.ITEM_STATUS.PENDING,
}, 'EL-38201'), {
}, 'BOX-001', { 'BOX-001': 1 }), {
type: 'processed',
item: scanItems[0],
status: state.ITEM_STATUS.PARTIAL,
})
assert.deepEqual(state.classifyScan(scanItems, {}, 'NO-SUCH-SKU'), {
assert.deepEqual(state.classifyScan(scanItems, {}, 'NO-SUCH-BOX'), {
type: 'unknown',
item: null,
})