优化
This commit is contained in:
@@ -1,14 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { auditEventLabel } from './presentation'
|
||||
import { auditDescriptionLabel, auditEventLabel, auditHttpMethodLabel, auditOperatorLabel, auditResourceLabel, auditServiceLabel } from './presentation'
|
||||
|
||||
describe('audit event presentation', () => {
|
||||
it('uses customer-facing labels for known event codes', () => {
|
||||
expect(auditEventLabel('PLATFORM_TENANT_UPDATE')).toBe('编辑客户档案')
|
||||
expect(auditEventLabel('TENANT_REVIEW')).toBe('客户入驻审核')
|
||||
expect(auditEventLabel('INBOUND_MEASURE_APPROVE')).toBe('入库测量审核通过')
|
||||
expect(auditEventLabel('INBOUND_WEIGHT_OCR_CONFIRM')).toBe('确认 OCR 重量')
|
||||
})
|
||||
|
||||
it('keeps unknown event codes visible for diagnosis', () => {
|
||||
expect(auditEventLabel('FUTURE_CUSTOMER_EVENT')).toBe('FUTURE_CUSTOMER_EVENT')
|
||||
it('uses a Chinese fallback instead of exposing an unknown technical code', () => {
|
||||
expect(auditEventLabel('INBOUND_CARTON_CREATE')).toBe('入库箱码创建')
|
||||
expect(auditEventLabel('FUTURE_CUSTOMER_EVENT')).toBe('客户')
|
||||
expect(auditEventLabel('')).toBe('—')
|
||||
})
|
||||
|
||||
it('localizes service, resource, operator and request method values', () => {
|
||||
expect(auditServiceLabel('firstleg-service')).toBe('头程履约服务')
|
||||
expect(auditResourceLabel('INBOUND_MEASUREMENT')).toBe('入库测量')
|
||||
expect(auditOperatorLabel('platform_admin')).toBe('平台管理员')
|
||||
expect(auditHttpMethodLabel('POST')).toBe('提交')
|
||||
})
|
||||
|
||||
it('prefers the Chinese half of a bilingual audit description', () => {
|
||||
expect(auditDescriptionLabel('Approve order / 审核通过')).toBe('审核通过')
|
||||
expect(auditDescriptionLabel('测量审核通过')).toBe('测量审核通过')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user