Skip to content

Commit 4635cca

Browse files
test(voice): make sure setup never opens the microphone
1 parent dae3fb2 commit 4635cca

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎apps/web/src/speech/useEnvironmentSpeechInput.browser.test.tsx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,29 @@ it("retries a failed transcription on the same chosen environment", async () =>
330330
expect(mocks.committed).toHaveBeenCalledExactlyOnceWith("second try", expect.anything());
331331
});
332332

333+
it.each([
334+
["missing-model", 0],
335+
["ready", 1],
336+
["cloud", null],
337+
] as const)("setup-only with %s never starts the microphone", async (target, wizardStep) => {
338+
setup({ destination: "env-a" });
339+
if (target === "cloud") {
340+
mocks.cloudVoiceCapable.add("env-a");
341+
chooseAudioDestination({
342+
kind: "cloud",
343+
environmentId: EnvironmentId.make("env-a"),
344+
provider: "openai",
345+
});
346+
} else {
347+
mocks.modelState = target;
348+
}
349+
await using _screen = await render(<Probe />);
350+
expect(mocks.voice.available).toBe(true);
351+
await act(() => mocks.voice.start({ setupOnly: true }));
352+
expect(mocks.microphoneRequests).toEqual([]);
353+
expect(mocks.voice.setup.open ? mocks.voice.setup.step : null).toBe(wizardStep);
354+
});
355+
333356
it("reopens setup after reconnecting during a download and ignores its stale completion", async () => {
334357
setup({ destination: "env-a" });
335358
mocks.modelState = "missing-model";

0 commit comments

Comments
 (0)