Skip to content

Commit b0c6494

Browse files
committed
test: update audio call detection and mock helpers
Add detection for Edge TTS CLI and macOS Say commands in test mocks. Update minimal config with new flags.
1 parent 42a8d2d commit b0c6494

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎tests/setup.js‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export function createMinimalConfig(overrides = {}) {
134134
enableTTSReminder: false, // Disable reminders in tests by default
135135
enableSound: false, // Disable sounds in tests by default
136136
enableToast: false, // Disable toasts in tests by default
137+
enableAIMessages: false, // Disable AI message generation in tests (avoids network calls)
137138
debugLog: false, // Disable debug logging in tests
138139
...overrides
139140
};
@@ -275,6 +276,7 @@ export function createMockShellRunner(options = {}) {
275276
// Add Bun shell methods to the promise
276277
promise.quiet = function() { return this; };
277278
promise.nothrow = function() { return this; };
279+
promise.timeout = function() { return this; };
278280

279281
return promise;
280282
};
@@ -608,17 +610,27 @@ export function getTTSCalls(shell) {
608610

609611
/**
610612
* Helper to detect any audio playback calls (sound or TTS) in mock shell history.
613+
* This includes both audio file playback AND TTS speech (which produces audio).
611614
*
612615
* @param {object} shell - Mock shell runner from createMockShellRunner()
613616
* @returns {Array} Array of audio-related calls
614617
*/
615618
export function getAudioCalls(shell) {
616619
return shell.getCalls().filter(c => {
617620
const cmd = c.command;
618-
// Windows audio playback
621+
// Windows audio playback (MediaPlayer)
619622
if (cmd.includes('System.Windows.Media.MediaPlayer')) {
620623
return true;
621624
}
625+
// Windows SAPI TTS (PowerShell script that speaks via System.Speech)
626+
// This also produces audio output!
627+
if (cmd.includes('powershell.exe') && cmd.includes('-File') && cmd.includes('.ps1')) {
628+
return true;
629+
}
630+
// Edge TTS CLI command (produces audio file then plays it)
631+
if (cmd.includes('edge-tts') && cmd.includes('--write-media')) {
632+
return true;
633+
}
622634
// Linux audio playback
623635
if (cmd.includes('paplay') || cmd.includes('aplay')) {
624636
return true;
@@ -627,6 +639,10 @@ export function getAudioCalls(shell) {
627639
if (cmd.includes('afplay')) {
628640
return true;
629641
}
642+
// macOS say command (TTS)
643+
if (cmd.includes('say ')) {
644+
return true;
645+
}
630646
return false;
631647
});
632648
}

0 commit comments

Comments
 (0)