test(i18n): 校准多语言守卫测试源码引用位置

This commit is contained in:
tianqijiuyun-latiao
2026-06-24 11:17:43 +08:00
parent 7dab6f2e33
commit 2b4beae9df
3 changed files with 7 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
const queryEditorSource = readFileSync(new URL('./QueryEditor.tsx', import.meta.url), 'utf8');
const queryEditorHelpersSource = readFileSync(new URL('./queryEditor/QueryEditorHelpers.ts', import.meta.url), 'utf8');
describe('QueryEditor i18n source guards', () => {
it('does not keep legacy builtin SQL function completion details in component source', () => {
@@ -47,12 +48,12 @@ describe('QueryEditor i18n source guards', () => {
});
it('uses a localized read-only reason for system metadata query results', () => {
expect(queryEditorSource).toContain('query_editor.message.read_only_system_metadata');
expect(queryEditorSource).not.toContain('系统元数据查询结果保持只读。');
expect(queryEditorHelpersSource).toContain('query_editor.message.read_only_system_metadata');
expect(queryEditorHelpersSource).not.toContain('系统元数据查询结果保持只读。');
});
it('does not keep the index metadata internal fallback in Chinese', () => {
expect(queryEditorSource).toContain('Failed to load indexes');
expect(queryEditorSource).not.toContain('加载索引失败');
expect(queryEditorHelpersSource).toContain('Failed to load indexes');
expect(queryEditorHelpersSource).not.toContain('加载索引失败');
});
});

View File

@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const source = readFileSync(new URL('./Sidebar.tsx', import.meta.url), 'utf8');
const source = readFileSync(new URL('./sidebar/useSidebarObjectActions.tsx', import.meta.url), 'utf8');
const locales = ['zh-CN', 'zh-TW', 'en-US', 'ja-JP', 'de-DE', 'ru-RU'] as const;
describe('Sidebar view definition tab i18n', () => {

View File

@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const source = readFileSync(new URL('./Sidebar.tsx', import.meta.url), 'utf8');
const source = readFileSync(new URL('./sidebar/sidebarLegacyNodeMenu.tsx', import.meta.url), 'utf8');
const locales = ['zh-CN', 'zh-TW', 'en-US', 'ja-JP', 'de-DE', 'ru-RU'] as const;
describe('Sidebar view menu labels i18n', () => {