99 * not just that they work in isolation.
1010 */
1111
12- import { useChatStore } from '../../../src/stores/chatStore' ;
1312import { useAppStore } from '../../../src/stores/appStore' ;
1413import { generationService } from '../../../src/services/generationService' ;
1514import { llmService } from '../../../src/services/llm' ;
@@ -70,8 +69,8 @@ describe('Generation Flow Integration', () => {
7069 const conversationId = setupWithConversation ( { modelId } ) ;
7170
7271 const tokens = [ 'Hello' , ' ' , 'world' , '!' ] ;
73- let streamCallback : ( ( token : string ) => void ) | null = null ;
74- let completeCallback : ( ( ) => void ) | null = null ;
72+ let streamCallback : any = null ;
73+ let completeCallback : any = null ;
7574
7675 mockLlmService . generateResponse . mockImplementation (
7776 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -102,7 +101,7 @@ describe('Generation Flow Integration', () => {
102101 expect ( generationService . getState ( ) . streamingContent ) . toBe ( 'Hello world!' ) ;
103102
104103 // Complete generation
105- completeCallback ?.( ) ;
104+ completeCallback ?.( '' ) ;
106105 await generatePromise ;
107106
108107 // Verify state reset
@@ -114,8 +113,8 @@ describe('Generation Flow Integration', () => {
114113 const modelId = setupWithActiveModel ( ) ;
115114 const conversationId = setupWithConversation ( { modelId } ) ;
116115
117- let streamCallback : ( ( token : string ) => void ) | null = null ;
118- let completeCallback : ( ( ) => void ) | null = null ;
116+ let streamCallback : any = null ;
117+ let completeCallback : any = null ;
119118
120119 mockLlmService . generateResponse . mockImplementation (
121120 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -141,16 +140,16 @@ describe('Generation Flow Integration', () => {
141140 await flushPromises ( ) ;
142141 expect ( onFirstToken ) . toHaveBeenCalledTimes ( 1 ) ;
143142
144- completeCallback ?.( ) ;
143+ completeCallback ?.( '' ) ;
145144 await generatePromise ;
146145 } ) ;
147146
148147 it ( 'should transition isThinking from true to false on first token' , async ( ) => {
149148 const modelId = setupWithActiveModel ( ) ;
150149 const conversationId = setupWithConversation ( { modelId } ) ;
151150
152- let streamCallback : ( ( token : string ) => void ) | null = null ;
153- let completeCallback : ( ( ) => void ) | null = null ;
151+ let streamCallback : any = null ;
152+ let completeCallback : any = null ;
154153
155154 mockLlmService . generateResponse . mockImplementation (
156155 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -173,7 +172,7 @@ describe('Generation Flow Integration', () => {
173172 await flushPromises ( ) ;
174173 expect ( generationService . getState ( ) . isThinking ) . toBe ( false ) ;
175174
176- completeCallback ?.( ) ;
175+ completeCallback ?.( '' ) ;
177176 await generatePromise ;
178177 } ) ;
179178 } ) ;
@@ -183,7 +182,7 @@ describe('Generation Flow Integration', () => {
183182 const modelId = setupWithActiveModel ( ) ;
184183 const conversationId = setupWithConversation ( { modelId } ) ;
185184
186- let completeCallback : ( ( ) => void ) | null = null ;
185+ let completeCallback : any = null ;
187186
188187 mockLlmService . generateResponse . mockImplementation (
189188 async ( _messages , _onStream , onComplete , _onError , _onThinking ) => {
@@ -202,16 +201,16 @@ describe('Generation Flow Integration', () => {
202201 expect ( chatState . streamingForConversationId ) . toBe ( conversationId ) ;
203202 expect ( chatState . isThinking ) . toBe ( true ) ;
204203
205- completeCallback ?.( ) ;
204+ completeCallback ?.( '' ) ;
206205 await generatePromise ;
207206 } ) ;
208207
209208 it ( 'should append tokens to chatStore streamingMessage' , async ( ) => {
210209 const modelId = setupWithActiveModel ( ) ;
211210 const conversationId = setupWithConversation ( { modelId } ) ;
212211
213- let streamCallback : ( ( token : string ) => void ) | null = null ;
214- let completeCallback : ( ( ) => void ) | null = null ;
212+ let streamCallback : any = null ;
213+ let completeCallback : any = null ;
215214
216215 mockLlmService . generateResponse . mockImplementation (
217216 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -235,7 +234,7 @@ describe('Generation Flow Integration', () => {
235234 await flushPromises ( ) ;
236235 expect ( getChatState ( ) . streamingMessage ) . toBe ( 'Hello world' ) ;
237236
238- completeCallback ?.( ) ;
237+ completeCallback ?.( '' ) ;
239238 await generatePromise ;
240239 } ) ;
241240
@@ -250,8 +249,8 @@ describe('Generation Flow Integration', () => {
250249 activeModelId : modelId ,
251250 } ) ;
252251
253- let streamCallback : ( ( token : string ) => void ) | null = null ;
254- let completeCallback : ( ( ) => void ) | null = null ;
252+ let streamCallback : any = null ;
253+ let completeCallback : any = null ;
255254
256255 mockLlmService . generateResponse . mockImplementation (
257256 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -271,7 +270,7 @@ describe('Generation Flow Integration', () => {
271270 await flushPromises ( ) ;
272271
273272 // Complete generation
274- completeCallback ?.( ) ;
273+ completeCallback ?.( '' ) ;
275274 await generatePromise ;
276275
277276 // Verify message was finalized
@@ -312,8 +311,8 @@ describe('Generation Flow Integration', () => {
312311 lastTokenCount : 75 ,
313312 } ) ;
314313
315- let streamCallback : ( ( token : string ) => void ) | null = null ;
316- let completeCallback : ( ( ) => void ) | null = null ;
314+ let streamCallback : any = null ;
315+ let completeCallback : any = null ;
317316
318317 mockLlmService . generateResponse . mockImplementation (
319318 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -329,7 +328,7 @@ describe('Generation Flow Integration', () => {
329328 await flushPromises ( ) ;
330329 streamCallback ?.( 'Response' ) ;
331330 await flushPromises ( ) ;
332- completeCallback ?.( ) ;
331+ completeCallback ?.( '' ) ;
333332 await generatePromise ;
334333
335334 const chatState = getChatState ( ) ;
@@ -347,11 +346,11 @@ describe('Generation Flow Integration', () => {
347346 const modelId = setupWithActiveModel ( ) ;
348347 const conversationId = setupWithConversation ( { modelId } ) ;
349348
350- let errorCallback : ( ( error : Error ) => void ) | null = null ;
349+ let _errorCallback : any = null ;
351350
352351 mockLlmService . generateResponse . mockImplementation (
353352 async ( _messages , _onStream , _onComplete , onError , _onThinking ) => {
354- errorCallback = onError ! ;
353+ _errorCallback = onError ! ;
355354 throw new Error ( 'Generation failed' ) ;
356355 }
357356 ) ;
@@ -429,7 +428,7 @@ describe('Generation Flow Integration', () => {
429428 const modelId = setupWithActiveModel ( ) ;
430429 const conversationId = setupWithConversation ( { modelId } ) ;
431430
432- let streamCallback : ( ( token : string ) => void ) | null = null ;
431+ let streamCallback : any = null ;
433432
434433 mockLlmService . generateResponse . mockImplementation (
435434 async ( _messages , onStream , _onComplete , _onError , _onThinking ) => {
@@ -478,7 +477,7 @@ describe('Generation Flow Integration', () => {
478477 activeModelId : modelId ,
479478 } ) ;
480479
481- let streamCallback : ( ( token : string ) => void ) | null = null ;
480+ let streamCallback : any = null ;
482481
483482 mockLlmService . generateResponse . mockImplementation (
484483 async ( _messages , onStream , _onComplete , _onError , _onThinking ) => {
@@ -536,8 +535,8 @@ describe('Generation Flow Integration', () => {
536535 const modelId = setupWithActiveModel ( ) ;
537536 const conversationId = setupWithConversation ( { modelId } ) ;
538537
539- let streamCallback : ( ( token : string ) => void ) | null = null ;
540- let completeCallback : ( ( ) => void ) | null = null ;
538+ let streamCallback : any = null ;
539+ let completeCallback : any = null ;
541540
542541 mockLlmService . generateResponse . mockImplementation (
543542 async ( _messages , onStream , onComplete , _onError , _onThinking ) => {
@@ -557,7 +556,7 @@ describe('Generation Flow Integration', () => {
557556 await flushPromises ( ) ;
558557 streamCallback ?.( 'Token' ) ;
559558 await flushPromises ( ) ;
560- completeCallback ?.( ) ;
559+ completeCallback ?.( '' ) ;
561560 await generatePromise ;
562561
563562 unsubscribe ( ) ;
@@ -566,15 +565,15 @@ describe('Generation Flow Integration', () => {
566565 expect ( values . length ) . toBeGreaterThan ( 1 ) ;
567566
568567 // First update after initial state should show generating
569- const generatingState = values . find ( v => v . isGenerating ) ;
568+ const generatingState = values . find ( ( v : any ) => v . isGenerating ) ;
570569 expect ( generatingState ) . toBeDefined ( ) ;
571570
572571 // Should have a state with content
573- const contentState = values . find ( v => v . streamingContent === 'Token' ) ;
572+ const contentState = values . find ( ( v : any ) => v . streamingContent === 'Token' ) ;
574573 expect ( contentState ) . toBeDefined ( ) ;
575574
576575 // Last state should be idle
577- const lastState = values [ values . length - 1 ] ;
576+ const lastState : any = values [ values . length - 1 ] ;
578577 expect ( lastState . isGenerating ) . toBe ( false ) ;
579578 } ) ;
580579 } ) ;
0 commit comments