test(dictation): drop casts from the shortcut mode tests

This commit is contained in:
Kelvin Amoaba
2026-11-09 05:22:32 +00:00
parent 6d49cf1680
commit 751574fe4b
2 changed files with 7 additions and 12 deletions
@@ -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')
@@ -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 {