本仓 2026-08-12 从 ssw main (192.168.1.18:13300/ssw/ssw-mvp) 的 dacli/ subpath 抽取,作为独立仓托管到 gitea:3000/ssw/dacli.git。 - 工作树为 ssw main dacli subpath 最新版 (110 commit, 08-12) - 历史未带 ssw main 整体历史(避免大仓污染) - 此为新仓基线 commit,未来以本仓历史为主
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { enrichDataInterfaceListWithEnCode } from '../../src/commands/di/list.ts'
|
|
|
|
describe('di list enCode enrichment', () => {
|
|
it('fills missing enCode from an id→enCode map', () => {
|
|
const selector = [
|
|
{
|
|
id: 'cat-a',
|
|
category: '0',
|
|
children: [
|
|
{ id: 'di-1', category: '1', fullName: '状态查询' },
|
|
{ id: 'di-2', category: '1', fullName: '审核查询' },
|
|
],
|
|
},
|
|
]
|
|
|
|
const result = enrichDataInterfaceListWithEnCode(selector, {
|
|
'di-1': 'statusQuery',
|
|
'di-2': 'auditQuery',
|
|
})
|
|
|
|
expect(result).toEqual([
|
|
{ id: 'di-1', category: '1', fullName: '状态查询', enCode: 'statusQuery' },
|
|
{ id: 'di-2', category: '1', fullName: '审核查询', enCode: 'auditQuery' },
|
|
])
|
|
})
|
|
|
|
it('leaves enCode alone when the selector already carries it', () => {
|
|
const result = enrichDataInterfaceListWithEnCode(
|
|
[{ id: 'di-1', category: '1', enCode: 'explicit', fullName: '已带编码' }],
|
|
{ 'di-1': 'overridden' },
|
|
)
|
|
expect(result[0].enCode).toBe('explicit')
|
|
})
|
|
})
|