|
|
@@ -0,0 +1,26 @@
|
|
|
+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')
|