This commit is contained in:
2026-09-11 18:44:04 +08:00
parent 35f245d067
commit c69e9411c7
6 changed files with 65 additions and 26 deletions
+6 -4
View File
@@ -4,8 +4,10 @@ import { readFile } from 'node:fs/promises'
const page = await readFile(new URL('../pages/picking/picking.vue', import.meta.url), 'utf8')
test('missing picking location does not render an empty badge or dangling separator', () => {
assert.match(page, /<text v-if="item\.location" class="pick-item-location">\{\{ item\.location \}\}<\/text>/)
assert.match(page, /item\.location \? `\$\{item\.sku\} · \$\{item\.location\}` : item\.sku/)
assert.doesNotMatch(page, /<text class="pick-item-location">\{\{ item\.location \}\}/)
test('picking card prioritizes location and inbound code without cargo or SKU text', () => {
assert.match(page, /<text class="pick-item-location" :class="\{ 'location-missing': !item\.location \}">库位 \{\{ item\.location \|\| '—' \}\}<\/text>/)
assert.match(page, /return `入仓码 \$\{item\.inboundCode \|\| '—'\}\$\{reason\}`/)
assert.match(page, /summarizeInventoryResources\(inventoryResources\)/)
assert.match(page, /location: item\.location \|\| item\.locationCode \|\| inventorySummary\.location/)
assert.doesNotMatch(page.match(/itemDescription\(item\) \{[\s\S]*?\n\t\t\t\}/)?.[0] || '', /item\.desc|cargoName|sku/i)
})
+9
View File
@@ -7,6 +7,15 @@ const state = await import(`data:text/javascript;base64,${Buffer.from(source).to
const items = [{ id: 1 }, { id: 2 }, { id: 3 }]
test('inventory resources expose distinct locations and total available cartons', () => {
assert.deepEqual(state.summarizeInventoryResources([
{ locationCode: 'A0', availablePackageCount: 4 },
{ locationCode: 'A0', availablePackageCount: 2 },
{ locationCode: 'B-03', availablePackageCount: 1 },
]), { location: 'A0、B-03', availablePackageCount: 7 })
assert.deepEqual(state.summarizeInventoryResources(null), { location: '', availablePackageCount: null })
})
test('createItemStates initializes every item as pending', () => {
assert.deepEqual(state.createItemStates(items), {
1: state.ITEM_STATUS.PENDING,