刘光辉
7 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, expect, it } from 'vitest';
 
import { getSubtableColumnLabel, isDmsBusinessCategory } from './subtableLabels';
 
describe('dms subtable labels', () => {
  const categories = [
    { id: 'dms-id', enCode: 'DMS', fullName: '文档管理' },
    { id: 'lims-id', enCode: 'LIMS', fullName: '实验室' },
  ];
 
  it('recognizes DMS by dictionary category rather than a fixed id', () => {
    expect(isDmsBusinessCategory('dms-id', categories)).toBe(true);
    expect(isDmsBusinessCategory('lims-id', categories)).toBe(false);
    expect(isDmsBusinessCategory('unknown', categories)).toBe(false);
  });
 
  it('uses bilingual defaults while retaining custom labels', () => {
    expect(getSubtableColumnLabel('index', undefined, true)).toBe('序号\nNo.');
    expect(getSubtableColumnLabel('action', '操作', true)).toBe('操作\nAction');
    expect(getSubtableColumnLabel('action', '审批\nApprove', true)).toBe('审批\nApprove');
    expect(getSubtableColumnLabel('index', undefined, false)).toBe('序号');
  });
});