feat(miniprogram): add pound QR label helpers and node checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-09-24 21:13:08 +08:00
1 parent a6e0c4481f
commit b1719fab23
2 files changed
+59

No files matched your search

+26
View File
@@ -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')