Files

27 lines
1016 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict'
import {
poundQrDialogTitle,
formatPoundQrProductLine,
normalizePoundQrRemarks
} from '../utils/dbPoundQr.js'
assert.equal(poundQrDialogTitle('出库'), '出库磅单二维码')
assert.equal(poundQrDialogTitle('入库'), '入库磅单二维码')
assert.equal(poundQrDialogTitle(''), '入库磅单二维码')
assert.equal(formatPoundQrProductLine({ product: '尿素', specification: '', quantity: 32 }, '吨'), '尿素(32 吨)')
assert.equal(
formatPoundQrProductLine({ product: '尿素颗粒', specification: '颗粒', quantity: 10 }, '吨'),
'尿素 颗粒(10 吨)'
)
assert.equal(
formatPoundQrProductLine({ product: '尿素', specification: '46%', quantity: 1 }, '吨'),
'尿素 46%(1 吨)'
)
assert.equal(normalizePoundQrRemarks({ remarks: '急单' }), '急单')
assert.equal(normalizePoundQrRemarks({ remark: '备货' }), '备货')
assert.equal(normalizePoundQrRemarks({ remarks: ' ', remark: '' }), '')
console.log('test_db_pound_qr: ok')