File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,20 +136,19 @@ describe("OpenClawApp dictation recorder lifecycle", () => {
136136 await app . toggleChatDictation ( ) ;
137137 const recorder = MockMediaRecorder . instances [ 0 ] ;
138138 recorder . emitData ( new Blob ( [ "audio" ] , { type : "audio/webm" } ) ) ;
139- transcribeChatAudioMock . mockImplementationOnce ( async ( ) => {
140- expect ( app . chatDictationChunks ) . toEqual ( [ ] ) ;
141- return null ;
142- } ) ;
139+ const transcription = createDeferred < null > ( ) ;
140+ transcribeChatAudioMock . mockReturnValueOnce ( transcription . promise ) ;
143141
144142 await app . toggleChatDictation ( ) ;
145- await Promise . resolve ( ) ;
146143
147144 expect ( app . chatDictationChunks ) . toEqual ( [ ] ) ;
148145 expect ( transcribeChatAudioMock ) . toHaveBeenCalledTimes ( 1 ) ;
149146 expect ( transcribeChatAudioMock . mock . calls [ 0 ] ?. [ 1 ] ) . toMatchObject ( {
150147 size : 5 ,
151148 type : "audio/webm" ,
152149 } ) ;
150+ transcription . resolve ( null ) ;
151+ await transcription . promise ;
153152 } ) ;
154153
155154 it ( "ignores duplicate starts while microphone permission is pending" , async ( ) => {
Original file line number Diff line number Diff line change @@ -1015,8 +1015,7 @@ export class OpenClawApp extends LitElement {
10151015 if ( this . chatDictationRecorder !== recorder ) {
10161016 return ;
10171017 }
1018- const chunks = [ ...this . chatDictationChunks ] ;
1019- this . chatDictationChunks = [ ] ;
1018+ const chunks = this . chatDictationChunks . splice ( 0 ) ;
10201019 const canceledByRequest = this . chatDictationCancelNextStop ;
10211020 this . chatDictationCancelNextStop = false ;
10221021 this . chatDictationRecorder = null ;
You can’t perform that action at this time.
0 commit comments