@@ -139,7 +139,7 @@ describe('ChatController', () => {
139139 expect ( addBotMessageSpy ) . not . toHaveBeenCalled ( )
140140 } )
141141
142- test ( 'verifies interactionId is passed through chat requests' , { timeout : 5000 } , async ( ) => {
142+ test ( 'verifies interactionId is passed through chat requests' , { timeout : 10000 } , async ( ) => {
143143 const mockRequestID = '0'
144144 mockContextRetriever . retrieveContext . mockResolvedValue ( [ ] )
145145
@@ -161,7 +161,7 @@ describe('ChatController', () => {
161161 )
162162 } )
163163
164- test ( 'send, followup, and edit' , { timeout : 3000 } , async ( ) => {
164+ test ( 'send, followup, and edit' , { timeout : 10000 } , async ( ) => {
165165 const postMessageSpy = vi
166166 . spyOn ( chatController as any , 'postMessage' )
167167 . mockImplementation ( ( ) => { } )
@@ -178,9 +178,16 @@ describe('ChatController', () => {
178178 signal : new AbortController ( ) . signal ,
179179 source : 'chat' ,
180180 } )
181- expect ( postMessageSpy . mock . calls . at ( - 1 ) ?. [ 0 ] ) . toStrictEqual <
182- Extract < ExtensionMessage , { type : 'transcript' } >
183- > ( {
181+ const firstTranscriptCall = postMessageSpy . mock . calls
182+ . filter (
183+ call =>
184+ call [ 0 ] &&
185+ typeof call [ 0 ] === 'object' &&
186+ 'type' in call [ 0 ] &&
187+ call [ 0 ] . type === 'transcript'
188+ )
189+ . at ( - 1 ) ?. [ 0 ]
190+ expect ( firstTranscriptCall ) . toStrictEqual < Extract < ExtensionMessage , { type : 'transcript' } > > ( {
184191 type : 'transcript' ,
185192 tokenUsage : undefined ,
186193 isMessageInProgress : true ,
@@ -330,9 +337,16 @@ describe('ChatController', () => {
330337 expect ( mockChatClient . chat ) . toBeCalledTimes ( 2 )
331338 expect ( addBotMessageSpy ) . toBeCalled ( )
332339
333- expect ( postMessageSpy . mock . calls . at ( - 1 ) ?. at ( 0 ) ) . toStrictEqual <
334- Extract < ExtensionMessage , { type : 'transcript' } >
335- > ( {
340+ const lastTranscriptCall = postMessageSpy . mock . calls
341+ . filter (
342+ call =>
343+ call [ 0 ] &&
344+ typeof call [ 0 ] === 'object' &&
345+ 'type' in call [ 0 ] &&
346+ call [ 0 ] . type === 'transcript'
347+ )
348+ . at ( - 1 ) ?. [ 0 ]
349+ expect ( lastTranscriptCall ) . toStrictEqual < Extract < ExtensionMessage , { type : 'transcript' } > > ( {
336350 type : 'transcript' ,
337351 isMessageInProgress : false ,
338352 chatID : mockNowDate . toUTCString ( ) ,
@@ -550,7 +564,7 @@ describe('ChatController', () => {
550564 {
551565 agent : undefined ,
552566 speaker : 'assistant' ,
553- model : FIXTURE_MODEL . id ,
567+ model : 'my-model' ,
554568 error : errorToChatError ( new Error ( 'my-error' ) ) ,
555569 intent : undefined ,
556570 manuallySelectedIntent : undefined ,
0 commit comments