From dcbcee9469dbfbe8b86bd42726ab38c39f69d8a5 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Thu, 22 Oct 2026 22:49:06 +0800 Subject: [PATCH] test(i18n): retain fallback coverage for unknown speech languages --- .../client-ui-voice-input/tests/preparation.client.spec.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/experimental/client-ui-voice-input/tests/preparation.client.spec.tsx b/packages/experimental/client-ui-voice-input/tests/preparation.client.spec.tsx index c080992866..38f13a83ff 100644 --- a/packages/experimental/client-ui-voice-input/tests/preparation.client.spec.tsx +++ b/packages/experimental/client-ui-voice-input/tests/preparation.client.spec.tsx @@ -114,7 +114,7 @@ it('persists settings and reports disconnection in the detail card', async () => const store = createSnapshotStore({ connected: true, error: null, catalog: { selection: { providerId: id, language: 'auto' }, maxAudioBytes: 100, maxDurationSeconds: 120, providers: [{ id, name: 'SenseVoiceSmall', location: 'host-local', languages: ['auto', 'zh', 'en', 'ja'], preparation: { phase: 'ready' } }, - { id: 'cloud' as SpeechProviderId, name: 'Cloud', location: 'cloud', languages: ['auto', 'en', 'zh', 'ja', 'fr'], preparation: { phase: 'ready' } }], + { id: 'cloud' as SpeechProviderId, name: 'Cloud', location: 'cloud', languages: ['auto', 'en', 'zh', 'ja', 'fr', 'it'], preparation: { phase: 'ready' } }], } }) const configure = vi.fn(async () => {}) const props = { useSpeechReadiness: bindSnapshotSelector(store), configure, t, @@ -128,8 +128,9 @@ it('persists settings and reports disconnection in the detail card', async () => act(() => { store.set({ ...current, catalog: { ...current.catalog!, selection: { providerId: 'cloud' as SpeechProviderId, language: 'en' } } }) }) expect(screen.getByText(zh.cloud)).toBeTruthy() expect(within(screen.getByLabelText(zh.language)).getAllByRole('option').map(item => item.value)) - .toEqual(['auto', 'en', 'zh', 'ja', 'fr']) + .toEqual(['auto', 'en', 'zh', 'ja', 'fr', 'it']) expect(within(screen.getByLabelText(zh.language)).getByRole('option', { name: zh.fr })).toBeTruthy() + expect(within(screen.getByLabelText(zh.language)).getByRole('option', { name: 'it' })).toBeTruthy() configure.mockRejectedValueOnce(new Error('settings are read-only')) fireEvent.change(screen.getByLabelText(zh.language), { target: { value: 'zh' } }) await screen.findByText('语音识别失败:settings are read-only')