import { describe, it, expect } from 'vitest'; import enUS from '@/lib/i18n/locales/en-US.json'; import zhCN from '@/lib/i18n/locales/zh-CN.json'; import zhTW from '@/lib/i18n/locales/zh-TW.json'; import jaJP from '@/lib/i18n/locales/ja-JP.json'; import ruRU from '@/lib/i18n/locales/ru-RU.json'; import arSA from '@/lib/i18n/locales/ar-SA.json'; import ptBR from '@/lib/i18n/locales/pt-BR.json'; const locales = { 'en-US': enUS, 'zh-CN': zhCN, 'zh-TW': zhTW, 'ja-JP': jaJP, 'ru-RU': ruRU, 'ar-SA': arSA, 'pt-BR': ptBR, }; // New keys introduced for the TTS provider-enablement model (#665). const KEYS = [ 'settings.ttsProviderEnabledLabel', 'settings.ttsProviderEnabledHint', 'settings.ttsProviderUnavailableHint', 'settings.ttsProviderDisabledByAdmin', 'agentBar.noVoice', ]; // eslint-disable-next-line @typescript-eslint/no-explicit-any -- locale JSON traversal const get = (o: any, k: string) => k.split('.').reduce((a, p) => a?.[p], o); describe('TTS enablement locale coverage (#665)', () => { it('every key exists, non-empty, and does not echo the key, in all 7 locales', () => { for (const [code, data] of Object.entries(locales)) { for (const k of KEYS) { const v = get(data, k); expect(typeof v, `${code} missing ${k}`).toBe('string'); expect((v as string).trim(), `${code} empty ${k}`).not.toBe(''); expect(v, `${code} echoes ${k}`).not.toBe(k); } } }); });