@@ -265,11 +265,12 @@ describe('Gemini Client (client.ts)', () => {
265265 } ,
266266 isInteractive : vi . fn ( ) . mockReturnValue ( false ) ,
267267 getExperiments : ( ) => { } ,
268- isModelAvailabilityServiceEnabled : vi . fn ( ) . mockReturnValue ( false ) ,
269268 getActiveModel : vi . fn ( ) . mockReturnValue ( 'test-model' ) ,
270269 setActiveModel : vi . fn ( ) ,
271270 resetTurn : vi . fn ( ) ,
272- getModelAvailabilityService : vi . fn ( ) ,
271+ getModelAvailabilityService : vi
272+ . fn ( )
273+ . mockReturnValue ( createAvailabilityServiceMock ( ) ) ,
273274 } as unknown as Config ;
274275 mockConfig . getHookSystem = vi
275276 . fn ( )
@@ -2006,9 +2007,6 @@ ${JSON.stringify(
20062007 vi . mocked ( mockConfig . getModelAvailabilityService ) . mockReturnValue (
20072008 mockAvailabilityService ,
20082009 ) ;
2009- vi . mocked ( mockConfig . isModelAvailabilityServiceEnabled ) . mockReturnValue (
2010- true ,
2011- ) ;
20122010 vi . mocked ( mockConfig . setActiveModel ) . mockClear ( ) ;
20132011 mockRouterService . route . mockResolvedValue ( {
20142012 model : 'model-a' ,
@@ -2611,14 +2609,14 @@ ${JSON.stringify(
26112609 const abortSignal = new AbortController ( ) . signal ;
26122610
26132611 await client . generateContent (
2614- { model : DEFAULT_GEMINI_FLASH_MODEL } ,
2612+ { model : 'test-model' } ,
26152613 contents ,
26162614 abortSignal ,
26172615 ) ;
26182616
26192617 expect ( mockContentGenerator . generateContent ) . toHaveBeenCalledWith (
26202618 {
2621- model : DEFAULT_GEMINI_FLASH_MODEL ,
2619+ model : 'test-model' ,
26222620 config : {
26232621 abortSignal,
26242622 systemInstruction : getCoreSystemPrompt ( { } as unknown as Config , '' ) ,
@@ -2632,50 +2630,18 @@ ${JSON.stringify(
26322630 } ) ;
26332631
26342632 it ( 'should use current model from config for content generation' , async ( ) => {
2635- const initialModel = client [ 'config' ] . getModel ( ) ;
2633+ const initialModel = 'test-model' ;
26362634 const contents = [ { role : 'user' , parts : [ { text : 'test' } ] } ] ;
2637- const currentModel = initialModel + '-changed' ;
2638-
2639- vi . spyOn ( client [ 'config' ] , 'getModel' ) . mockReturnValueOnce ( currentModel ) ;
26402635
26412636 await client . generateContent (
2642- { model : DEFAULT_GEMINI_FLASH_MODEL } ,
2637+ { model : initialModel } ,
26432638 contents ,
26442639 new AbortController ( ) . signal ,
26452640 ) ;
26462641
2647- expect ( mockContentGenerator . generateContent ) . not . toHaveBeenCalledWith ( {
2648- model : initialModel ,
2649- config : expect . any ( Object ) ,
2650- contents,
2651- } ) ;
26522642 expect ( mockContentGenerator . generateContent ) . toHaveBeenCalledWith (
2653- {
2654- model : DEFAULT_GEMINI_FLASH_MODEL ,
2655- config : expect . any ( Object ) ,
2656- contents,
2657- } ,
2658- 'test-session-id' ,
2659- ) ;
2660- } ) ;
2661-
2662- it ( 'should use the Flash model when fallback mode is active' , async ( ) => {
2663- const contents = [ { role : 'user' , parts : [ { text : 'hello' } ] } ] ;
2664- const abortSignal = new AbortController ( ) . signal ;
2665- const requestedModel = 'gemini-2.5-pro' ; // A non-flash model
2666-
2667- // Mock config to be in fallback mode
2668- vi . spyOn ( client [ 'config' ] , 'isInFallbackMode' ) . mockReturnValue ( true ) ;
2669-
2670- await client . generateContent (
2671- { model : requestedModel } ,
2672- contents ,
2673- abortSignal ,
2674- ) ;
2675-
2676- expect ( mockGenerateContentFn ) . toHaveBeenCalledWith (
26772643 expect . objectContaining ( {
2678- model : DEFAULT_GEMINI_FLASH_MODEL ,
2644+ model : initialModel ,
26792645 } ) ,
26802646 'test-session-id' ,
26812647 ) ;
0 commit comments