@@ -15,12 +15,17 @@ import type { Config } from '../config/config.js';
1515import {
1616 DEFAULT_GEMINI_FLASH_LITE_MODEL ,
1717 DEFAULT_GEMINI_MODEL_AUTO ,
18+ PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL ,
19+ PREVIEW_GEMINI_3_1_MODEL ,
1820} from '../config/models.js' ;
21+ import { AuthType } from '../core/contentGenerator.js' ;
1922
2023const createMockConfig = ( overrides : Partial < Config > = { } ) : Config =>
2124 ( {
2225 getUserTier : ( ) => undefined ,
2326 getModel : ( ) => 'gemini-2.5-pro' ,
27+ getGemini31LaunchedSync : ( ) => false ,
28+ getContentGeneratorConfig : ( ) => ( { authType : undefined } ) ,
2429 ...overrides ,
2530 } ) as unknown as Config ;
2631
@@ -128,6 +133,27 @@ describe('policyHelpers', () => {
128133 expect ( chain [ 0 ] ?. model ) . toBe ( 'gemini-2.5-pro' ) ;
129134 expect ( chain [ 1 ] ?. model ) . toBe ( 'gemini-2.5-flash' ) ;
130135 } ) ;
136+
137+ it ( 'returns Gemini 3.1 Pro chain when launched and auto-gemini-3 requested' , ( ) => {
138+ const config = createMockConfig ( {
139+ getModel : ( ) => 'auto-gemini-3' ,
140+ getGemini31LaunchedSync : ( ) => true ,
141+ } ) ;
142+ const chain = resolvePolicyChain ( config ) ;
143+ expect ( chain [ 0 ] ?. model ) . toBe ( PREVIEW_GEMINI_3_1_MODEL ) ;
144+ expect ( chain [ 1 ] ?. model ) . toBe ( 'gemini-3-flash-preview' ) ;
145+ } ) ;
146+
147+ it ( 'returns Gemini 3.1 Pro Custom Tools chain when launched, auth is Gemini, and auto-gemini-3 requested' , ( ) => {
148+ const config = createMockConfig ( {
149+ getModel : ( ) => 'auto-gemini-3' ,
150+ getGemini31LaunchedSync : ( ) => true ,
151+ getContentGeneratorConfig : ( ) => ( { authType : AuthType . USE_GEMINI } ) ,
152+ } ) ;
153+ const chain = resolvePolicyChain ( config ) ;
154+ expect ( chain [ 0 ] ?. model ) . toBe ( PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL ) ;
155+ expect ( chain [ 1 ] ?. model ) . toBe ( 'gemini-3-flash-preview' ) ;
156+ } ) ;
131157 } ) ;
132158
133159 describe ( 'buildFallbackPolicyContext' , ( ) => {
0 commit comments