feat:寄卖增加对接客服,db脚本迁移修复
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import { formatConsignmentContactSupporter } from '../src/utils/consignment-contact.ts'
|
||||
|
||||
test('对接客服:姓名 + 电话/微信一起展示', () => {
|
||||
const display = formatConsignmentContactSupporter({
|
||||
contactSupporterName: '小张',
|
||||
contactSupporterPhone: '13800001111',
|
||||
contactSupporterWechat: 'wx_zhang',
|
||||
})
|
||||
assert.equal(display.name, '小张')
|
||||
assert.equal(display.contact, '电话 13800001111 · 微信 wx_zhang')
|
||||
assert.equal(display.text, '小张 · 电话 13800001111 · 微信 wx_zhang')
|
||||
})
|
||||
|
||||
test('对接客服:只有姓名时不拼联系方式', () => {
|
||||
const display = formatConsignmentContactSupporter({ contactSupporterName: '小李' })
|
||||
assert.equal(display.text, '小李')
|
||||
})
|
||||
|
||||
test('对接客服:历史数据没有姓名时回退为未指定', () => {
|
||||
assert.equal(formatConsignmentContactSupporter(null).text, '未指定')
|
||||
assert.equal(formatConsignmentContactSupporter({}).text, '未指定')
|
||||
})
|
||||
|
||||
test('对接客服:自定义空值文案', () => {
|
||||
assert.equal(formatConsignmentContactSupporter(undefined, '-').text, '-')
|
||||
})
|
||||
Reference in New Issue
Block a user