Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

test(windows): tighten windowsHide spawn assertions and match test naming convention

Gabriel Stein84d9e85afa4e
diff --git a/test/helpers/windows-helper-spawn-hide.test.js b/test/helpers/windows-helper-spawn-hide.test.js
deleted file mode 100644
index 5c6763f80..000000000
--- a/test/helpers/windows-helper-spawn-hide.test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const test = require("node:test");
-const assert = require("node:assert/strict");
-const fs = require("fs");
-const path = require("path");
-
-const ROOT = path.join(__dirname, "../..");
-
-function read(rel) {
- return fs.readFileSync(path.join(ROOT, rel), "utf8");
-}
-
-test("meeting AEC helper spawn sets windowsHide", () => {
- const src = read("src/helpers/meetingAecManager.js");
- assert.match(
- src,
- /spawn\(binaryPath,\s*\["--sample-rate"[\s\S]*?windowsHide:\s*true/
- );
-});
-
-test("text edit monitor spawns set windowsHide", () => {
- const src = read("src/helpers/textEditMonitor.js");
- const hides = (src.match(/windowsHide:\s*true/g) || []).length;
- assert.ok(hides >= 2, `expected both monitor spawns to set windowsHide, got ${hides}`);
-});
-
-test("Windows mic-listener spawn sets windowsHide", () => {
- const src = read("src/helpers/audioActivityDetector.js");
- assert.match(
- src,
- /_tryEventDrivenWin32[\s\S]*?spawn\(binaryPath,\s*\["--exclude-pid"[\s\S]*?windowsHide:\s*true/
- );
-});
diff --git a/test/helpers/windowsHelperSpawnHide.test.js b/test/helpers/windowsHelperSpawnHide.test.js
new file mode 100644
index 000000000..c68a11144
--- /dev/null
+++ b/test/helpers/windowsHelperSpawnHide.test.js
@@ -0,0 +1,27 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const fs = require("fs");
+const path = require("path");
+
+function read(rel) {
+ return fs.readFileSync(path.join(__dirname, "../..", rel), "utf8");
+}
+
+function hiddenSpawnCount(src) {
+ return (src.match(/spawn\([^{}]*\{[^{}]*windowsHide: true/g) || []).length;
+}
+
+test("meeting AEC helper spawn sets windowsHide", () => {
+ assert.equal(hiddenSpawnCount(read("src/helpers/meetingAecManager.js")), 1);
+});
+
+test("text edit monitor spawns set windowsHide", () => {
+ assert.equal(hiddenSpawnCount(read("src/helpers/textEditMonitor.js")), 2);
+});
+
+test("Windows mic-listener spawn sets windowsHide", () => {
+ assert.match(
+ read("src/helpers/audioActivityDetector.js"),
+ /spawn\(binaryPath, \["--exclude-pid"[^{}]*\{[^{}]*windowsHide: true/
+ );
+});