chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -23,65 +23,65 @@ describe('generatePdfAssetsUrl', () => {
const originalRegion = global.REGION;
beforeEach(() => {
// 重置模拟
// Reset simulation
vi.resetAllMocks();
});
afterEach(() => {
// 恢复原始 REGION
// Restore original REGION value
global.REGION = originalRegion;
});
it('应该为 cmaps 生成正确的 URL中国区域', () => {
// 设置区域为中国
// Set the region to China
global.REGION = 'cn';
const url = generatePdfAssetsUrl('cmaps');
// 验证 URL 格式
// Verify URL format
expect(url).toContain('//lf-cdn.coze.cn/obj/unpkg');
expect(url).toContain(pkg.name.replace(/^@/, ''));
expect(url).toContain('lib/cmaps/');
});
it('应该为 pdf.worker 生成正确的 URL中国区域', () => {
// 设置区域为中国
// Set the region to China
global.REGION = 'cn';
const url = generatePdfAssetsUrl('pdf.worker');
// 验证 URL 格式
// Verify URL format
expect(url).toContain('//lf-cdn.coze.cn/obj/unpkg');
expect(url).toContain(pkg.name.replace(/^@/, ''));
expect(url).toContain('lib/worker.js');
});
it('应该为 cmaps 生成正确的 URL国际区域', () => {
// 设置区域为国际
// Set the region to International
global.REGION = 'va';
const url = generatePdfAssetsUrl('cmaps');
// 验证 URL 格式
// Verify URL format
expect(url).toContain('//sf-cdn.coze.com/obj/unpkg-va');
expect(url).toContain(pkg.name.replace(/^@/, ''));
expect(url).toContain('lib/cmaps/');
});
it('应该为 pdf.worker 生成正确的 URL国际区域', () => {
// 设置区域为国际
// Set the region to International
global.REGION = 'va';
const url = generatePdfAssetsUrl('pdf.worker');
// 验证 URL 格式
// Verify URL format
expect(url).toContain('//sf-cdn.coze.com/obj/unpkg-va');
expect(url).toContain(pkg.name.replace(/^@/, ''));
expect(url).toContain('lib/worker.js');
});
it('应该在传入无效资源类型时抛出错误', () => {
// 使用类型断言来测试错误情况
// Use type assertions to test error conditions
expect(() => generatePdfAssetsUrl('invalid' as any)).toThrow(
'目前只支持引用 cmaps 与 pdf.worker 文件',
);