24 lines
903 B
TypeScript
24 lines
903 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { formatConsignmentContactSupporter } from '../src/utils/consignment-contact.ts'
|
|
|
|
test('对接客服:展示姓名', () => {
|
|
const display = formatConsignmentContactSupporter({ contactSupporterName: '小张' })
|
|
assert.equal(display.name, '小张')
|
|
assert.equal(display.text, '小张')
|
|
})
|
|
|
|
test('对接客服:姓名首尾空白会被清理', () => {
|
|
assert.equal(formatConsignmentContactSupporter({ contactSupporterName: ' 小李 ' }).text, '小李')
|
|
})
|
|
|
|
test('对接客服:历史数据没有姓名时回退为未指定', () => {
|
|
assert.equal(formatConsignmentContactSupporter(null).text, '未指定')
|
|
assert.equal(formatConsignmentContactSupporter({}).text, '未指定')
|
|
})
|
|
|
|
test('对接客服:自定义空值文案', () => {
|
|
assert.equal(formatConsignmentContactSupporter(undefined, '-').text, '-')
|
|
})
|