Files
shanxia2.0/web-admin/scripts/quota-cert-waiver.test.ts
T
wuzilong d5f3a79ea5 fix(pl): 新规则安排不再被本地合同绑证缺口误拦。
H5 运输计划验收发现 customer_category 在服务端自动选证已通过时,前端仍用合同绑证空缺拦截安排;同步用证面板从占用回填证号并补专项单测。
2026-11-15 08:22:46 +08:00

37 lines
1.4 KiB
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { toxicArrangeBlockMessage } from '../src/utils/pl-quota-cert-waiver'
const unbound = '合同HT-1尚未绑定购买证和运输证,请先到合同中绑定后再安排运输'
test('marked plans ignore the local certificate gap and keep source errors', () => {
assert.equal(toxicArrangeBlockMessage({ quotaCertWaived: true, arrangeBlockMessage: '' }, unbound), '')
assert.equal(
toxicArrangeBlockMessage({ quotaCertWaived: true, arrangeBlockMessage: '这一段还没有关联合同' }, unbound),
'这一段还没有关联合同'
)
})
test('unmarked plans still block on the server message or the local certificate gap', () => {
assert.equal(toxicArrangeBlockMessage({ arrangeBlockMessage: '证件余量不足' }, unbound), '证件余量不足')
assert.equal(toxicArrangeBlockMessage({ arrangeBlockMessage: '' }, unbound), unbound)
assert.equal(toxicArrangeBlockMessage(null, unbound), unbound)
})
test('customer_category plans trust the server arrange check and ignore local contract-binding gaps', () => {
assert.equal(
toxicArrangeBlockMessage(
{ certQuotaRuleVersion: 'customer_category', arrangeBlockMessage: '' },
unbound
),
''
)
assert.equal(
toxicArrangeBlockMessage(
{ certQuotaRuleVersion: 'customer_category', arrangeBlockMessage: '证件余量不足' },
unbound
),
'证件余量不足'
)
})