Files
admin-web/src/modules/customers/customerDialogTitle.test.ts
T

17 lines
906 B
TypeScript

import { describe, expect, it } from 'vitest'
import { customerDialogTitle } from './customerDialogTitle'
describe('customer operation titles', () => {
it('identifies the customer by its trimmed business code', () => {
expect(customerDialogTitle('编辑客户', { tenantCode: ' C0008 ', tenantName: '客户公司' })).toBe('编辑客户 · C0008')
})
it('uses the company name when a business code is unavailable', () => {
expect(customerDialogTitle('客户入驻审核', { tenantCode: ' ', tenantName: ' 客户公司 ' })).toBe('客户入驻审核 · 客户公司')
})
it('does not expose database IDs when both business identifiers are absent', () => {
const customer = { id: '987654321', tenantCode: null, tenantName: ' ' }
expect(customerDialogTitle('删除客户', customer)).toBe('删除客户')
expect(customerDialogTitle('新增客户')).toBe('新增客户')
})
})