refactor: 全局去除误导性AI描述与浮夸修饰,面向生产环境标准化商务智能术语
这个提交包含在:
@@ -217,6 +217,37 @@ describe('OmniCard AI 名片主移动名片中心 (useCardHome.uts)', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('3. formatSvgDataUri 转换契约', () => {
|
||||
it('3.1 遇到 <svg 开头的字符串转为 data:image/svg+xml;utf8,...', () => {
|
||||
const { formatSvgDataUri } = loadUseCardHome() as unknown as {
|
||||
formatSvgDataUri: (svg: string) => string;
|
||||
};
|
||||
|
||||
const raw = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 31"><path d="M0 0h31v31H0z"/></svg>';
|
||||
const result = formatSvgDataUri(raw);
|
||||
expect(result.startsWith('data:image/svg+xml;utf8,')).toBe(true);
|
||||
expect(result).toContain(encodeURIComponent('<path d="M0 0h31v31H0z"/>'));
|
||||
});
|
||||
|
||||
it('3.2 遇到已经是 http/https 或 data: 开头的链接保持原样', () => {
|
||||
const { formatSvgDataUri } = loadUseCardHome() as unknown as {
|
||||
formatSvgDataUri: (svg: string) => string;
|
||||
};
|
||||
|
||||
expect(formatSvgDataUri('https://cdn.example.com/qr.png')).toBe('https://cdn.example.com/qr.png');
|
||||
expect(formatSvgDataUri('data:image/png;base64,ABC')).toBe('data:image/png;base64,ABC');
|
||||
});
|
||||
|
||||
it('3.3 遇到空串或无效值返回空串', () => {
|
||||
const { formatSvgDataUri } = loadUseCardHome() as unknown as {
|
||||
formatSvgDataUri: (svg: string) => string;
|
||||
};
|
||||
|
||||
expect(formatSvgDataUri('')).toBe('');
|
||||
expect(formatSvgDataUri(' ')).toBe('');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('OmniCard AI 名片主名片中心页契约 (index.uvue)', () => {
|
||||
|
||||
在新工单中引用
屏蔽一个用户