补齐证书齐备、证件折算、移动用证和合同绑定,并带上报销批量发放、付款备注以及个人开发流程升级,便于继续讨论已安排计划的调整规则。 Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
import {
|
|
formatDriverProductQty,
|
|
formatSiteProductQty
|
|
} from '../src/components/business/pl-plan-stop-feedback-panel/qty-display'
|
|
|
|
const echoCode = (_dictType: string, value: string) => value
|
|
const dictLabel = (_dictType: string, value: string) => {
|
|
if (value === 'dun') return '吨'
|
|
if (value === 'kg') return '千克'
|
|
return value
|
|
}
|
|
|
|
test('driver feedback shows unit label instead of dict code', () => {
|
|
assert.equal(formatDriverProductQty({ actualQty: 12, unit: 'dun' }, echoCode), '12 吨')
|
|
assert.equal(formatDriverProductQty({ actualQty: 3, unit: 'kg' }, dictLabel), '3 千克')
|
|
assert.equal(formatDriverProductQty({ actualQty: null, unit: 'dun' }, echoCode), '—')
|
|
assert.equal(formatDriverProductQty({ actualQty: 1, unit: '' }, echoCode), '1 吨')
|
|
})
|
|
|
|
test('site feedback shows unit label instead of dict code', () => {
|
|
assert.deepEqual(formatSiteProductQty({ actualQty: 8, unit: 'dun' }, echoCode), {
|
|
qty: '8',
|
|
unit: ' 吨'
|
|
})
|
|
assert.deepEqual(formatSiteProductQty({ quantity: 2, unit: 'ping' }, echoCode), {
|
|
qty: '2',
|
|
unit: ' 瓶'
|
|
})
|
|
assert.deepEqual(
|
|
formatSiteProductQty({ actualQty: null, quantity: null, unit: 'dun' }, echoCode),
|
|
{
|
|
qty: '—',
|
|
unit: ''
|
|
}
|
|
)
|
|
})
|