mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-24 23:40:22 +08:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const source = readFileSync(new URL('./Sidebar.tsx', import.meta.url), 'utf8');
|
|
|
|
const locales = ['zh-CN', 'zh-TW', 'en-US', 'ja-JP', 'de-DE', 'ru-RU'] as const;
|
|
const requiredKeys = [
|
|
'sidebar.table_folder.columns',
|
|
'sidebar.table_folder.indexes',
|
|
'sidebar.table_folder.foreign_keys',
|
|
'sidebar.table_folder.triggers',
|
|
];
|
|
|
|
describe('Sidebar table folder i18n', () => {
|
|
it('localizes table child folder titles', () => {
|
|
["title: '列'", "title: '索引'", "title: '外键'", "title: '触发器'"].forEach((snippet) => {
|
|
expect(source).not.toContain(snippet);
|
|
});
|
|
|
|
requiredKeys.forEach((key) => {
|
|
expect(source).toContain(`t('${key}'`);
|
|
});
|
|
});
|
|
|
|
it('keeps table folder keys available in every locale', () => {
|
|
locales.forEach((locale) => {
|
|
const catalog = JSON.parse(readFileSync(new URL(`../../../shared/i18n/${locale}.json`, import.meta.url), 'utf8')) as Record<string, string>;
|
|
requiredKeys.forEach((key) => {
|
|
expect(catalog[key], `${locale}:${key}`).toBeTruthy();
|
|
});
|
|
});
|
|
});
|
|
});
|