GeezerVison is showing github.com — test(voice): make sure setup never opens the microphone · pingdotgg/t3code@4635cca
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/web/src/speech/useEnvironmentSpeechInput.browser.test.tsx +23Lines changed: 23 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -330,6 +330,29 @@ it("retries a failed transcription on the same chosen environment", async () => |
330 | 330 | expect(mocks.committed).toHaveBeenCalledExactlyOnceWith("second try", expect.anything()); |
331 | 331 | }); |
332 | 332 |
|
| 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 | + |
333 | 356 | it("reopens setup after reconnecting during a download and ignores its stale completion", async () => { |
334 | 357 | setup({ destination: "env-a" }); |
335 | 358 | mocks.modelState = "missing-model"; |
|