@@ -28,6 +28,7 @@ const mocks = vi.hoisted(() => ({
2828 settings : { } as Record < string , unknown > ,
2929 connected : new Set < string > ( ) ,
3030 voiceCapable : new Set < string > ( ) ,
31+ cloudVoiceCapable : new Set < string > ( ) ,
3132 canDictate : new Set < string > ( ) ,
3233 prepared : new Map < string , unknown > ( ) ,
3334 primaryEnvironmentId : "primary-env" ,
@@ -68,7 +69,10 @@ vi.mock("../state/environments", () => ({
6869 environmentId,
6970 serverConfig : {
7071 environment : {
71- capabilities : { voiceTranscription : mocks . voiceCapable . has ( environmentId ) } ,
72+ capabilities : {
73+ voiceTranscription : mocks . voiceCapable . has ( environmentId ) ,
74+ cloudVoiceTranscription : mocks . cloudVoiceCapable . has ( environmentId ) ,
75+ } ,
7276 } ,
7377 } ,
7478 }
@@ -176,6 +180,7 @@ function setup(options: { readonly destination?: string | null } = {}) {
176180 mocks . primaryEnvironmentId = "primary-env" ;
177181 mocks . connected = new Set ( [ "primary-env" , THREAD_ENV , "env-a" , "env-b" ] ) ;
178182 mocks . voiceCapable = new Set ( [ "primary-env" , THREAD_ENV , "env-a" , "env-b" ] ) ;
183+ mocks . cloudVoiceCapable . clear ( ) ;
179184 mocks . canDictate = new Set ( mocks . voiceCapable ) ;
180185 mocks . prepared . clear ( ) ;
181186 mocks . statusRequests = [ ] ;
@@ -435,15 +440,18 @@ it("uses neither destination when the cloud save marker cannot be read", async (
435440 expectNoAudioSent ( ) ;
436441} ) ;
437442
438- it ( "cleans the transcript only after cleanup is separately enabled" , async ( ) => {
443+ it ( "cleans text on a cloud- only draft environment only while cleanup is separately enabled" , async ( ) => {
439444 setup ( { destination : "env-a" } ) ;
445+ mocks . voiceCapable . delete ( THREAD_ENV ) ;
446+ mocks . cloudVoiceCapable . add ( THREAD_ENV ) ;
440447 chooseTranscriptCleanup ( true ) ;
441448 const nearby = "x" . repeat ( 1_024 ) ;
442449 mocks . draft = "unrelated private paragraph " + nearby ;
443450 await using screen = await render ( < Probe /> ) ;
444451 await act ( ( ) => mocks . voice . start ( ) ) ;
445452 await act ( ( ) => mocks . voice . stop ( ) ) ;
446- expect ( mocks . cleanupCalls ) . toHaveLength ( 1 ) ;
453+ expect ( mocks . transcribeCalls ) . toEqual ( [ "env-a" ] ) ;
454+ expect ( mocks . cleanupCalls ) . toEqual ( [ THREAD_ENV ] ) ;
447455 expect ( mocks . cleanupDraft ) . toHaveBeenCalledExactlyOnceWith ( {
448456 text : nearby ,
449457 selection : { start : nearby . length , end : nearby . length } ,
@@ -468,6 +476,7 @@ it.each([
468476 "keeps a recording without authorized cleanup off the provider: $cleanup / $authorized" ,
469477 async ( { cleanup, authorized } ) => {
470478 setup ( { destination : "env-a" } ) ;
479+ mocks . cloudVoiceCapable . add ( THREAD_ENV ) ;
471480 chooseTranscriptCleanup ( true ) ;
472481 mocks . settings . speechCorrectionWord = "sorry" ;
473482 if ( ! authorized ) mocks . canDictate . delete ( THREAD_ENV ) ;
0 commit comments