fix(appointment): show readable source and preview blockers

This commit is contained in:
2026-10-15 17:33:36 +08:00
parent db1e9ee27b
commit f9193a3564
4 changed files with 35 additions and 3 deletions
@@ -1,7 +1,20 @@
import { expect, it } from 'vitest'
import { actionAllowed, actionRoute, referenceRoute, commandName, workDate, workStatus } from './workPresentation'
import { actionAllowed, actionRoute, referenceRoute, commandName, workDate, workStatus, workReason } from './workPresentation'
import { followAction, workItem } from './work.test-support'
import type { WorkAction } from './workApi'
it.each([
['SOURCE_TIMEZONE', '原业务作业地点时区待核实'],
['SOURCE_CONFIGURATION', '原货源或仓库配置待核实'],
['LASTLEG_SOURCE', '尾程货源待建立'],
['READY_WINDOW_UNVERIFIED', '货物备妥窗口待核实'],
['CARGO_QUANTITY_REVIEW', '货量或重复关联需要核对。'],
])('shows readable text for work item reason %s', (code, expected) => {
expect(workReason(code)).toBe(expected)
})
it('preserves the server explanation for an overdue or blocked work item', () => {
expect(workReason('作业日期已过,尚未完成')).toBe('作业日期已过,尚未完成')
expect(workReason('实际提柜后才能记录直送卸货')).toBe('实际提柜后才能记录直送卸货')
})
it('links original dispatch and delivery references by business number without inventing unknown routes', () => {
expect(referenceRoute({ kind: 'DISPATCH', key: 'DISPATCH:9007199254740999', businessNo: 'DS/001', label: '客户仓排车' })).toBe('/overseas-warehouse/dispatches?dispatchNo=DS%2F001')
expect(referenceRoute({ kind: 'DELIVERY', key: 'internal', businessNo: 'DL/001', label: '原派送' })).toBe('/overseas-warehouse/delivery-orders/DL%2F001')