补齐证书齐备、证件折算、移动用证和合同绑定,并带上报销批量发放、付款备注以及个人开发流程升级,便于继续讨论已安排计划的调整规则。 Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
import {
|
|
buyPartyName,
|
|
certFaceFields,
|
|
expiryWarning,
|
|
salePartyName
|
|
} from '../src/views/pl/quota-cert/cert-list-face'
|
|
|
|
const today = new Date(2026, 10, 4)
|
|
|
|
test('purchase and transport certificates use their own party names', () => {
|
|
assert.equal(salePartyName({ certType: 'purchase', sellerName: '销售方', shipperName: '货主' }), '销售方')
|
|
assert.equal(buyPartyName({ certType: 'purchase', buyerName: '购买方', consigneeName: '收货方' }), '购买方')
|
|
assert.equal(salePartyName({ certType: 'transport', sellerName: '销售方', shipperName: '货主' }), '货主')
|
|
assert.equal(buyPartyName({ certType: 'transport', buyerName: '购买方', consigneeName: '收货方' }), '收货方')
|
|
assert.equal(salePartyName({ certType: 'transport', salePartyName: '已汇总货主', shipperName: '货主' }), '已汇总货主')
|
|
})
|
|
|
|
test('contract certificate face fields stay beside the shared quantity labels', () => {
|
|
assert.deepEqual(
|
|
certFaceFields({
|
|
certType: 'transport',
|
|
shipperName: '货主',
|
|
consigneeName: '收货方',
|
|
validUseText: '一次有效',
|
|
validTo: '2026-11-04'
|
|
}).map((item) => item.label),
|
|
['销售单位', '购买单位', '有效次数', '是否预警']
|
|
)
|
|
const [seller, buyer, times, alert] = certFaceFields({
|
|
certType: 'transport',
|
|
shipperName: '货主',
|
|
consigneeName: '收货方',
|
|
validUseText: '一次有效',
|
|
validTo: '2026-11-04'
|
|
})
|
|
assert.equal(seller.value, '货主')
|
|
assert.equal(buyer.value, '收货方')
|
|
assert.equal(times.value, '一次有效')
|
|
assert.equal(alert.value, '今天到期')
|
|
assert.equal(alert.alert, true)
|
|
})
|
|
|
|
test('only certificates expiring within seven days show a red warning label', () => {
|
|
assert.equal(expiryWarning('2026-11-04', today)?.label, '今天到期')
|
|
assert.equal(expiryWarning('2026-11-11', today)?.label, '7天后到期')
|
|
assert.equal(expiryWarning('2026-11-03', today), null)
|
|
assert.equal(expiryWarning('2026-11-12', today), null)
|
|
assert.equal(expiryWarning('', today), null)
|
|
})
|