From 751574fe4b7dc0cbdfc2547ea2d01a42d27806e3 Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Mon, 9 Nov 2026 04:20:14 +0000 Subject: [PATCH] test(dictation): drop casts from the shortcut mode tests --- .../createMainWindow-terminal-focus-shortcuts.test.ts | 9 +++------ .../dictation/use-hold-dictation-gesture.test.tsx | 10 ++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts b/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts index 1e78595e19a..48936c7ebdd 100644 --- a/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts +++ b/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts @@ -109,18 +109,15 @@ describe('createMainWindow', () => { voice.dictationMode = 'auto' const autoPreventDefault = vi.fn() - windowHandlers['before-input-event']( - { preventDefault: autoPreventDefault } as never, - dictationInput as never - ) + windowHandlers['before-input-event']({ preventDefault: autoPreventDefault }, dictationInput) expect(autoPreventDefault).not.toHaveBeenCalled() expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') voice.dictationMode = 'toggle' const composingPreventDefault = vi.fn() windowHandlers['before-input-event']( - { preventDefault: composingPreventDefault } as never, - { ...dictationInput, isComposing: true } as never + { preventDefault: composingPreventDefault }, + { ...dictationInput, isComposing: true } ) expect(composingPreventDefault).not.toHaveBeenCalled() expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') diff --git a/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx b/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx index 81bdbd9415d..5df45cb9304 100644 --- a/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx +++ b/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx @@ -5,6 +5,7 @@ import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { DictationState } from '../../../../shared/speech-types' import type { GlobalSettings } from '../../../../shared/global-settings-types' +import { getDefaultSettings, getDefaultVoiceSettings } from '../../../../shared/constants' import { useHoldDictationGesture } from './use-hold-dictation-gesture' const originalUserAgent = navigator.userAgent @@ -26,13 +27,10 @@ function setUserAgent(userAgent: string): void { function holdSettings(): GlobalSettings { return { + ...getDefaultSettings('/home/test'), terminalShortcutPolicy, - voice: { - enabled: true, - sttModel: 'test-model', - dictationMode - } - } as GlobalSettings + voice: { ...getDefaultVoiceSettings(), enabled: true, sttModel: 'test-model', dictationMode } + } } function Probe(): null {