File size: 34,358 Bytes
7a1ad33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { describe, it, expect } from 'vitest';
import {
  resolveModel,
  resolveClassifierModel,
  isGemini3Model,
  isGemini2Model,
  isCustomModel,
  supportsModernFeatures,
  isAutoModel,
  getDisplayString,
  DEFAULT_GEMINI_MODEL,
  PREVIEW_GEMINI_MODEL,
  DEFAULT_GEMINI_FLASH_MODEL,
  DEFAULT_GEMINI_3_5_FLASH_MODEL,
  DEFAULT_GEMINI_FLASH_LITE_MODEL,
  supportsMultimodalFunctionResponse,
  GEMINI_MODEL_ALIAS_PRO,
  GEMINI_MODEL_ALIAS_FLASH,
  GEMINI_MODEL_ALIAS_FLASH_LITE,
  GEMINI_MODEL_ALIAS_AUTO,
  PREVIEW_GEMINI_FLASH_MODEL,
  PREVIEW_GEMINI_MODEL_AUTO,
  DEFAULT_GEMINI_MODEL_AUTO,
  isActiveModel,
  PREVIEW_GEMINI_3_1_MODEL,
  PREVIEW_GEMINI_FLASH_LITE_MODEL,
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
  isPreviewModel,
  isProModel,
  GEMMA_4_31B_IT_MODEL,
  GEMMA_4_26B_A4B_IT_MODEL,
  getAutoModelDescription,
} from './models.js';
import type { Config } from './config.js';
import { ModelConfigService } from '../services/modelConfigService.js';
import { DEFAULT_MODEL_CONFIGS } from './defaultModelConfigs.js';

const modelConfigService = new ModelConfigService(DEFAULT_MODEL_CONFIGS);

const dynamicConfig = {
  getExperimentalDynamicModelConfiguration: () => true,
  modelConfigService,
} as unknown as Config;

const legacyConfig = {
  getExperimentalDynamicModelConfiguration: () => false,
  modelConfigService,
} as unknown as Config;

describe('Dynamic Configuration Parity', () => {
  const modelsToTest = [
    GEMINI_MODEL_ALIAS_AUTO,
    GEMINI_MODEL_ALIAS_PRO,
    GEMINI_MODEL_ALIAS_FLASH,
    PREVIEW_GEMINI_MODEL_AUTO,
    DEFAULT_GEMINI_MODEL_AUTO,
    PREVIEW_GEMINI_MODEL,
    DEFAULT_GEMINI_MODEL,
    'custom-model',
  ];

  const flagCombos = [
    {
      useGemini3_1: false,
      useCustomToolModel: false,
    },
    {
      useGemini3_1: true,
      useCustomToolModel: false,
    },
    {
      useGemini3_1: true,
      useCustomToolModel: true,
    },
  ];

  it('resolveModel should match legacy behavior when dynamicModelConfiguration flag enabled.', () => {
    for (const model of modelsToTest) {
      for (const flags of flagCombos) {
        for (const hasAccess of [true, false]) {
          const mockLegacyConfig = {
            // eslint-disable-next-line @typescript-eslint/no-misused-spread
            ...legacyConfig,
            getHasAccessToPreviewModel: () => hasAccess,
          } as unknown as Config;
          const mockDynamicConfig = {
            // eslint-disable-next-line @typescript-eslint/no-misused-spread
            ...dynamicConfig,
            getHasAccessToPreviewModel: () => hasAccess,
          } as unknown as Config;

          const legacy = resolveModel(
            model,
            flags.useGemini3_1,
            flags.useCustomToolModel,
            hasAccess,
            mockLegacyConfig,
          );
          const dynamic = resolveModel(
            model,
            flags.useGemini3_1,
            flags.useCustomToolModel,
            hasAccess,
            mockDynamicConfig,
          );
          expect(dynamic).toBe(legacy);
        }
      }
    }
  });

  it('resolveClassifierModel should match legacy behavior.', () => {
    const classifierTiers = [GEMINI_MODEL_ALIAS_PRO, GEMINI_MODEL_ALIAS_FLASH];
    const anchorModels = [
      PREVIEW_GEMINI_MODEL_AUTO,
      DEFAULT_GEMINI_MODEL_AUTO,
      PREVIEW_GEMINI_MODEL,
      DEFAULT_GEMINI_MODEL,
    ];

    for (const hasAccess of [true, false]) {
      const mockLegacyConfig = {
        // eslint-disable-next-line @typescript-eslint/no-misused-spread
        ...legacyConfig,
        getHasAccessToPreviewModel: () => hasAccess,
      } as unknown as Config;
      const mockDynamicConfig = {
        // eslint-disable-next-line @typescript-eslint/no-misused-spread
        ...dynamicConfig,
        getHasAccessToPreviewModel: () => hasAccess,
      } as unknown as Config;

      for (const tier of classifierTiers) {
        for (const anchor of anchorModels) {
          for (const flags of flagCombos) {
            const legacy = resolveClassifierModel(
              anchor,
              tier,
              flags.useGemini3_1,
              flags.useCustomToolModel,
              hasAccess,
              mockLegacyConfig,
            );
            const dynamic = resolveClassifierModel(
              anchor,
              tier,
              flags.useGemini3_1,
              flags.useCustomToolModel,
              hasAccess,
              mockDynamicConfig,
            );
            expect(dynamic).toBe(legacy);
          }
        }
      }
    }
  });

  it('getDisplayString should match legacy behavior', () => {
    for (const model of modelsToTest) {
      const legacy = getDisplayString(model, legacyConfig);
      const dynamic = getDisplayString(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });

  it('isPreviewModel should match legacy behavior', () => {
    const allModels = [
      ...modelsToTest,
      PREVIEW_GEMINI_3_1_MODEL,
      PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
      PREVIEW_GEMINI_FLASH_MODEL,
    ];
    for (const model of allModels) {
      const legacy = isPreviewModel(model, legacyConfig);
      const dynamic = isPreviewModel(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });

  it('isProModel should match legacy behavior', () => {
    for (const model of modelsToTest) {
      const legacy = isProModel(model, legacyConfig);
      const dynamic = isProModel(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });

  it('isGemini3Model should match legacy behavior', () => {
    for (const model of modelsToTest) {
      const legacy = isGemini3Model(model, legacyConfig);
      const dynamic = isGemini3Model(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });

  it('isCustomModel should match legacy behavior', () => {
    for (const model of modelsToTest) {
      const legacy = isCustomModel(model, legacyConfig);
      const dynamic = isCustomModel(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });

  it('supportsMultimodalFunctionResponse should match legacy behavior', () => {
    for (const model of modelsToTest) {
      const legacy = supportsMultimodalFunctionResponse(model, legacyConfig);
      const dynamic = supportsMultimodalFunctionResponse(model, dynamicConfig);
      expect(dynamic).toBe(legacy);
    }
  });
});

describe('isPreviewModel', () => {
  const PREVIEW_MODELS = [
    PREVIEW_GEMINI_MODEL,
    PREVIEW_GEMINI_3_1_MODEL,
    PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
    PREVIEW_GEMINI_FLASH_MODEL,
    PREVIEW_GEMINI_FLASH_LITE_MODEL,
  ];

  it('should return true for active preview models', () => {
    for (const model of PREVIEW_MODELS) {
      if (model !== 'none') {
        expect(isPreviewModel(model)).toBe(true);
      }
    }
    expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
    expect(isPreviewModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
  });

  it('should return false if a preview model is retired (set to none)', () => {
    const retiredModels = PREVIEW_MODELS.filter((m) => m === 'none');
    for (const model of retiredModels) {
      expect(isPreviewModel(model)).toBe(false);
    }
  });

  it('should return false for non-preview models', () => {
    expect(isPreviewModel(DEFAULT_GEMINI_MODEL)).toBe(false);
    expect(isPreviewModel('gemini-1.5-pro')).toBe(false);
  });
});

describe('isProModel', () => {
  it('should return true for models containing "pro"', () => {
    expect(isProModel('gemini-3-pro-preview')).toBe(true);
    expect(isProModel('gemini-2.5-pro')).toBe(true);
    expect(isProModel('pro')).toBe(true);
  });

  it('should return false for models without "pro"', () => {
    expect(isProModel('gemini-3-flash-preview')).toBe(false);
    expect(isProModel('gemini-2.5-flash')).toBe(false);
    expect(isProModel('auto')).toBe(false);
  });
});

describe('isCustomModel', () => {
  it('should return true for models not starting with gemini-', () => {
    expect(isCustomModel('testing')).toBe(true);
    expect(isCustomModel('gpt-4')).toBe(true);
    expect(isCustomModel('claude-3')).toBe(true);
  });

  it('should return false for Gemini models', () => {
    expect(isCustomModel('gemini-1.5-pro')).toBe(false);
    expect(isCustomModel('gemini-2.0-flash')).toBe(false);
    expect(isCustomModel('gemini-3-pro-preview')).toBe(false);
  });

  it('should return false for aliases that resolve to Gemini models', () => {
    expect(isCustomModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(false);
    expect(isCustomModel(GEMINI_MODEL_ALIAS_PRO)).toBe(false);
  });

  it('should not throw if the model is an array (e.g. from yargs)', () => {
    // @ts-expect-error - testing invalid runtime input
    expect(() => isCustomModel(['gemini-2.0-flash', 'gpt-4'])).not.toThrow();
    // @ts-expect-error - testing invalid runtime input
    expect(isCustomModel(['gemini-2.0-flash', 'gpt-4'])).toBe(true); // last one is custom
  });
});

describe('supportsModernFeatures', () => {
  it('should return true for Gemini 3 models', () => {
    expect(supportsModernFeatures('gemini-3-pro-preview')).toBe(true);
    expect(supportsModernFeatures('gemini-3-flash-preview')).toBe(true);
  });

  it('should return true for custom models', () => {
    expect(supportsModernFeatures('testing')).toBe(true);
    expect(supportsModernFeatures('some-custom-model')).toBe(true);
  });

  it('should return false for older Gemini models', () => {
    expect(supportsModernFeatures('gemini-2.5-pro')).toBe(false);
    expect(supportsModernFeatures('gemini-2.5-flash')).toBe(false);
    expect(supportsModernFeatures('gemini-2.0-flash')).toBe(false);
    expect(supportsModernFeatures('gemini-1.5-pro')).toBe(false);
    expect(supportsModernFeatures('gemini-1.0-pro')).toBe(false);
  });

  it('should return true for modern aliases', () => {
    expect(supportsModernFeatures(GEMINI_MODEL_ALIAS_PRO)).toBe(true);
    expect(supportsModernFeatures(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
  });
});

describe('isGemini3Model', () => {
  it('should return true for gemini-3 models', () => {
    expect(isGemini3Model('gemini-3-pro-preview')).toBe(true);
    expect(isGemini3Model('gemini-3-flash-preview')).toBe(true);
  });

  it('should return true for aliases that resolve to Gemini 3', () => {
    expect(isGemini3Model(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
    expect(isGemini3Model(GEMINI_MODEL_ALIAS_PRO)).toBe(true);
    expect(isGemini3Model(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
  });

  it('should return false for Gemini 2 models', () => {
    expect(isGemini3Model('gemini-2.5-pro')).toBe(false);
    expect(isGemini3Model('gemini-2.5-flash')).toBe(false);
    expect(isGemini3Model(DEFAULT_GEMINI_MODEL_AUTO)).toBe(false);
  });

  it('should return false for arbitrary strings', () => {
    expect(isGemini3Model('gpt-4')).toBe(false);
  });
});

describe('getDisplayString', () => {
  it('should return Auto (Gemini 3) for preview auto model', () => {
    expect(getDisplayString(PREVIEW_GEMINI_MODEL_AUTO)).toBe('Auto (Gemini 3)');
  });

  it('should return Auto (Gemini 2.5) for default auto model', () => {
    expect(getDisplayString(DEFAULT_GEMINI_MODEL_AUTO)).toBe(
      'Auto (Gemini 2.5)',
    );
  });

  it('should return concrete model name for pro alias', () => {
    expect(getDisplayString(GEMINI_MODEL_ALIAS_PRO)).toBe(PREVIEW_GEMINI_MODEL);
  });

  it('should return concrete model name for flash alias', () => {
    expect(getDisplayString(GEMINI_MODEL_ALIAS_FLASH)).toBe(
      PREVIEW_GEMINI_FLASH_MODEL,
    );
  });

  it('should return PREVIEW_GEMINI_3_1_MODEL for PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL', () => {
    expect(getDisplayString(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(
      PREVIEW_GEMINI_3_1_MODEL,
    );
  });

  it('should return PREVIEW_GEMINI_FLASH_LITE_MODEL for PREVIEW_GEMINI_FLASH_LITE_MODEL', () => {
    expect(getDisplayString(PREVIEW_GEMINI_FLASH_LITE_MODEL)).toBe(
      PREVIEW_GEMINI_FLASH_LITE_MODEL,
    );
  });

  it('should return the model name as is for other models', () => {
    expect(getDisplayString('custom-model')).toBe('custom-model');
    expect(getDisplayString(GEMMA_4_31B_IT_MODEL)).toBe(GEMMA_4_31B_IT_MODEL);
    expect(getDisplayString(GEMMA_4_26B_A4B_IT_MODEL)).toBe(
      GEMMA_4_26B_A4B_IT_MODEL,
    );
    expect(getDisplayString(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(
      DEFAULT_GEMINI_FLASH_LITE_MODEL,
    );
  });
});

describe('supportsMultimodalFunctionResponse', () => {
  it('should return true for gemini-3 model', () => {
    expect(supportsMultimodalFunctionResponse('gemini-3-pro')).toBe(true);
  });

  it('should return false for gemini-2 models', () => {
    expect(supportsMultimodalFunctionResponse('gemini-2.5-pro')).toBe(false);
    expect(supportsMultimodalFunctionResponse('gemini-2.5-flash')).toBe(false);
  });

  it('should return false for other models', () => {
    expect(supportsMultimodalFunctionResponse('some-other-model')).toBe(false);
    expect(supportsMultimodalFunctionResponse('')).toBe(false);
  });
});

describe('resolveModel', () => {
  describe('delegation logic', () => {
    it('should return the Preview Pro model when auto-gemini-3 is requested', () => {
      const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO);
      expect(model).toBe(PREVIEW_GEMINI_MODEL);
    });

    it('should return Gemini 3.1 Pro when auto-gemini-3 is requested and useGemini3_1 is true', () => {
      const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true);
      expect(model).toBe(PREVIEW_GEMINI_3_1_MODEL);
    });

    it('should return Gemini 3.1 Pro Custom Tools when auto-gemini-3 is requested, useGemini3_1 is true, and useCustomToolModel is true', () => {
      const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, true);
      expect(model).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
    });

    it('should return the Default Pro model when auto-gemini-2.5 is requested', () => {
      const model = resolveModel(DEFAULT_GEMINI_MODEL_AUTO);
      expect(model).toBe(DEFAULT_GEMINI_MODEL);
    });

    it('should return the Default Flash-Lite model when flash-lite is requested', () => {
      const model = resolveModel(GEMINI_MODEL_ALIAS_FLASH_LITE);
      expect(model).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
    });

    it('should return the Flash-Lite model when flash-lite is requested', () => {
      const model = resolveModel(GEMINI_MODEL_ALIAS_FLASH_LITE, false);
      expect(model).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
    });

    it('should return the requested model as-is for explicit specific models', () => {
      expect(resolveModel(DEFAULT_GEMINI_MODEL)).toBe(DEFAULT_GEMINI_MODEL);
      expect(resolveModel(DEFAULT_GEMINI_FLASH_MODEL)).toBe(
        DEFAULT_GEMINI_FLASH_MODEL,
      );
      expect(resolveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(
        DEFAULT_GEMINI_FLASH_LITE_MODEL,
      );
    });

    it('should return a custom model name when requested', () => {
      const customModel = 'custom-model-v1';
      const model = resolveModel(customModel);
      expect(model).toBe(customModel);
    });

    it('should handle non-string inputs gracefully', () => {
      // @ts-expect-error - testing invalid runtime input
      expect(resolveModel(['a', 'b'])).toBe('b');
      // @ts-expect-error - testing invalid runtime input
      expect(resolveModel(true)).toBe('true');
      // @ts-expect-error - testing invalid runtime input
      expect(resolveModel(null)).toBe('');
    });
  });

  describe('hasAccessToPreview logic', () => {
    it('should return default model when access to preview is false and preview model is requested', () => {
      expect(resolveModel(PREVIEW_GEMINI_MODEL, false, false, false)).toBe(
        DEFAULT_GEMINI_MODEL,
      );
    });

    it('should return default flash model when access to preview is false and preview flash model is requested', () => {
      expect(
        resolveModel(PREVIEW_GEMINI_FLASH_MODEL, false, false, false),
      ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    });

    it('should return default flash lite model when access to preview is false and preview flash lite model is requested', () => {
      expect(
        resolveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, false, false),
      ).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
    });

    it('should return default model when access to preview is false and auto-gemini-3 is requested', () => {
      expect(resolveModel(PREVIEW_GEMINI_MODEL_AUTO, false, false, false)).toBe(
        DEFAULT_GEMINI_MODEL,
      );
    });

    it('should return default model when access to preview is false and Gemini 3.1 is requested', () => {
      expect(resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, false, false)).toBe(
        DEFAULT_GEMINI_MODEL,
      );
    });

    it('should still return default model when access to preview is false and auto-gemini-2.5 is requested', () => {
      expect(resolveModel(DEFAULT_GEMINI_MODEL_AUTO, false, false, false)).toBe(
        DEFAULT_GEMINI_MODEL,
      );
    });
  });
});

describe('isGemini2Model', () => {
  it('should return true for gemini-2.5-pro', () => {
    expect(isGemini2Model('gemini-2.5-pro')).toBe(true);
  });

  it('should return true for gemini-2.5-flash', () => {
    expect(isGemini2Model('gemini-2.5-flash')).toBe(true);
  });

  it('should return true for gemini-2.0-flash', () => {
    expect(isGemini2Model('gemini-2.0-flash')).toBe(true);
  });

  it('should return false for gemini-1.5-pro', () => {
    expect(isGemini2Model('gemini-1.5-pro')).toBe(false);
  });

  it('should return false for gemini-3-pro', () => {
    expect(isGemini2Model('gemini-3-pro')).toBe(false);
  });

  it('should return false for arbitrary strings', () => {
    expect(isGemini2Model('gpt-4')).toBe(false);
  });
});

describe('isAutoModel', () => {
  it('should return true for "auto"', () => {
    expect(isAutoModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
  });

  it('should return true for "auto-gemini-3"', () => {
    expect(isAutoModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
  });

  it('should return true for "auto-gemini-2.5"', () => {
    expect(isAutoModel(DEFAULT_GEMINI_MODEL_AUTO)).toBe(true);
  });

  it('should return false for concrete models', () => {
    expect(isAutoModel(DEFAULT_GEMINI_MODEL)).toBe(false);
    expect(isAutoModel(PREVIEW_GEMINI_MODEL)).toBe(false);
    expect(isAutoModel('some-random-model')).toBe(false);
  });
});

describe('resolveClassifierModel', () => {
  it('should return flash model when alias is flash', () => {
    expect(
      resolveClassifierModel(
        DEFAULT_GEMINI_MODEL_AUTO,
        GEMINI_MODEL_ALIAS_FLASH,
      ),
    ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    expect(
      resolveClassifierModel(
        PREVIEW_GEMINI_MODEL_AUTO,
        GEMINI_MODEL_ALIAS_FLASH,
      ),
    ).toBe(PREVIEW_GEMINI_FLASH_MODEL);
  });

  it('should return pro model when alias is pro', () => {
    expect(
      resolveClassifierModel(DEFAULT_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_PRO),
    ).toBe(DEFAULT_GEMINI_MODEL);
    expect(
      resolveClassifierModel(PREVIEW_GEMINI_MODEL_AUTO, GEMINI_MODEL_ALIAS_PRO),
    ).toBe(PREVIEW_GEMINI_MODEL);
  });

  it('should return Gemini 3.1 Pro when alias is pro and useGemini3_1 is true', () => {
    expect(
      resolveClassifierModel(
        PREVIEW_GEMINI_MODEL_AUTO,
        GEMINI_MODEL_ALIAS_PRO,
        true,
      ),
    ).toBe(PREVIEW_GEMINI_3_1_MODEL);
  });

  it('should return Gemini 3.1 Pro Custom Tools when alias is pro, useGemini3_1 is true, and useCustomToolModel is true', () => {
    expect(
      resolveClassifierModel(
        PREVIEW_GEMINI_MODEL_AUTO,
        GEMINI_MODEL_ALIAS_PRO,
        true,
        true,
      ),
    ).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
  });
});

describe('isActiveModel', () => {
  it('should return true for valid models when useGemini3_1 is false', () => {
    expect(isActiveModel(DEFAULT_GEMINI_MODEL)).toBe(true);
    expect(isActiveModel(PREVIEW_GEMINI_MODEL)).toBe(true);
    expect(isActiveModel(DEFAULT_GEMINI_FLASH_MODEL)).toBe(true);
  });

  it('should return true for Gemma 4 models when experimentalGemma is not provided (defaults to true)', () => {
    expect(isActiveModel(GEMMA_4_31B_IT_MODEL)).toBe(true);
    expect(isActiveModel(GEMMA_4_26B_A4B_IT_MODEL)).toBe(true);
    expect(isActiveModel(GEMMA_4_31B_IT_MODEL, false, false, true)).toBe(true);
    expect(isActiveModel(GEMMA_4_26B_A4B_IT_MODEL, false, false, true)).toBe(
      true,
    );
  });

  it('should return false for Gemini 3.1 models when Gemini 3.1 is not launched', () => {
    expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL)).toBe(false);
  });

  it('should return true for unknown models and aliases', () => {
    expect(isActiveModel('invalid-model')).toBe(false);
    expect(isActiveModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(false);
  });

  it('should return false for PREVIEW_GEMINI_MODEL when useGemini3_1 is true', () => {
    expect(isActiveModel(PREVIEW_GEMINI_MODEL, true)).toBe(false);
  });

  it('should return true for other valid models when useGemini3_1 is true', () => {
    expect(isActiveModel(DEFAULT_GEMINI_MODEL, true)).toBe(true);
  });

  it('should handle PREVIEW_GEMINI_FLASH_LITE_MODEL activity correctly based on retirement status', () => {
    if (PREVIEW_GEMINI_FLASH_LITE_MODEL === 'none') {
      expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, true)).toBe(
        false,
      );
      expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
        false,
      );
    } else {
      expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, true)).toBe(
        true,
      );
      expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
        true,
      );
    }
    expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
      true,
    );
    expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
      true,
    );
    expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, true, false)).toBe(
      true,
    );
  });

  it('should correctly filter Gemini 3.1 models based on useCustomToolModel when useGemini3_1 is true', () => {
    // When custom tools are preferred, standard 3.1 should be inactive
    expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, true)).toBe(false);
    expect(
      isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, true),
    ).toBe(true);

    // When custom tools are NOT preferred, custom tools 3.1 should be inactive
    expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, false)).toBe(true);
    expect(
      isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, false),
    ).toBe(false);
  });

  it('should return false for Gemini 3.1 preview models when useGemini3_1 is false', () => {
    expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, false, false, true)).toBe(
      false,
    );
    expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, false, false, false)).toBe(
      false,
    );
    expect(
      isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, false, false, true),
    ).toBe(false);
    expect(
      isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, false, false, false),
    ).toBe(false);
    if (PREVIEW_GEMINI_FLASH_LITE_MODEL !== 'none') {
      expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
        false,
      );
    }
    expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
      true,
    );
  });
});

describe('Gemini 3.1 Config Resolution', () => {
  it('PREVIEW_GEMINI_3_1_MODEL should resolve to chat-base-3 config (including thinkingLevel)', () => {
    const resolved = modelConfigService.getResolvedConfig({
      model: PREVIEW_GEMINI_3_1_MODEL,
      isChatModel: true,
    });
    expect(
      resolved.generateContentConfig?.thinkingConfig?.thinkingLevel,
    ).toBeDefined();
  });

  it('PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL should resolve to chat-base-3 config (including thinkingLevel)', () => {
    const resolved = modelConfigService.getResolvedConfig({
      model: PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
      isChatModel: true,
    });
    expect(
      resolved.generateContentConfig?.thinkingConfig?.thinkingLevel,
    ).toBeDefined();
  });

  it('PREVIEW_GEMINI_FLASH_LITE_MODEL should resolve to appropriate config based on retirement status', () => {
    if (PREVIEW_GEMINI_FLASH_LITE_MODEL === 'none') {
      // If none, it falls back to chat-base which may not have thinkingLevel
      const resolved = modelConfigService.getResolvedConfig({
        model: PREVIEW_GEMINI_FLASH_LITE_MODEL,
        isChatModel: true,
      });
      expect(resolved.model).toBe(PREVIEW_GEMINI_FLASH_LITE_MODEL);
    } else {
      const resolved = modelConfigService.getResolvedConfig({
        model: PREVIEW_GEMINI_FLASH_LITE_MODEL,
        isChatModel: true,
      });
      expect(
        resolved.generateContentConfig?.thinkingConfig?.thinkingLevel,
      ).toBeDefined();
    }
  });
});

describe('getAutoModelDescription', () => {
  it('should return Gemini 2.5 description when hasAccessToPreview is false', () => {
    const desc = getAutoModelDescription(false, false);
    expect(desc).toContain('gemini-2.5-pro');
    expect(desc).toContain('gemini-2.5-flash');
  });

  it('should return Gemini 3.0 description when hasAccessToPreview is true', () => {
    const desc = getAutoModelDescription(true, false);
    expect(desc).toContain('gemini-3-pro-preview');
    expect(desc).toContain('gemini-3-flash-preview');
  });

  it('should return Gemini 3.1 description when hasAccessToPreview and useGemini3_1 are true', () => {
    const desc = getAutoModelDescription(true, true);
    expect(desc).toContain('gemini-3.1-pro-preview');
    expect(desc).toContain('gemini-3-flash-preview');
  });

  it('should return Gemini 3.5 Flash description when hasAccessToPreview and useGemini3_5Flash are true', () => {
    const desc = getAutoModelDescription(true, true, true);
    expect(desc).toContain('gemini-3.1-pro-preview');
    expect(desc).toContain(DEFAULT_GEMINI_3_5_FLASH_MODEL);
  });
});

describe('resolveModel Gemini 3.5 Flash GA', () => {
  it('should resolve known non-preview flash models to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (legacy)', () => {
    expect(
      resolveModel(
        GEMINI_MODEL_ALIAS_FLASH,
        false,
        false,
        true,
        undefined,
        true,
      ),
    ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    expect(
      resolveModel(
        DEFAULT_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        undefined,
        true,
      ),
    ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    expect(
      resolveModel(
        PREVIEW_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        undefined,
        true,
      ),
    ).toBe(PREVIEW_GEMINI_FLASH_MODEL);
  });

  it.each([
    'gemini-3.6-flash',
    'gemini-3.7-flash',
    'gemini-3.8-flash',
    'gemini-9.9-flash',
  ])(
    'should preserve the explicit versioned model %s when useGemini3_5Flash is true (legacy)',
    (model) => {
      expect(resolveModel(model, false, false, true, undefined, true)).toBe(
        model,
      );
    },
  );

  it('should resolve known non-preview flash models to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
    const mockDynamicConfig = {
      getExperimentalDynamicModelConfiguration: () => true,
      modelConfigService,
    } as unknown as Config;

    expect(
      resolveModel(
        GEMINI_MODEL_ALIAS_FLASH,
        false,
        false,
        true,
        mockDynamicConfig,
        true,
      ),
    ).toBe('gemini-3.5-flash');
    expect(
      resolveModel(
        DEFAULT_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        mockDynamicConfig,
        true,
      ),
    ).toBe('gemini-3.5-flash');
    expect(
      resolveModel(
        PREVIEW_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        mockDynamicConfig,
        true,
      ),
    ).toBe(PREVIEW_GEMINI_FLASH_MODEL);
  });

  it('should NOT resolve flash models to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is false', () => {
    expect(
      resolveModel(
        GEMINI_MODEL_ALIAS_FLASH,
        false,
        false,
        true,
        undefined,
        false,
      ),
    ).toBe(PREVIEW_GEMINI_FLASH_MODEL);
    expect(
      resolveModel(
        DEFAULT_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        undefined,
        false,
      ),
    ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    expect(
      resolveModel(
        PREVIEW_GEMINI_FLASH_MODEL,
        false,
        false,
        true,
        undefined,
        false,
      ),
    ).toBe(PREVIEW_GEMINI_FLASH_MODEL);
  });

  it('should resolve to DEFAULT_GEMINI_FLASH_MODEL when GA is false AND preview access is false (dynamic)', () => {
    const mockDynamicConfig = {
      getExperimentalDynamicModelConfiguration: () => true,
      modelConfigService,
    } as unknown as Config;

    expect(
      resolveModel(
        DEFAULT_GEMINI_FLASH_MODEL,
        false,
        false,
        false, // No preview access
        mockDynamicConfig,
        false, // GA false
      ),
    ).toBe('gemini-2.5-flash');
  });

  it('should resolve auto to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true and classifier selects flash', () => {
    expect(
      resolveClassifierModel(
        GEMINI_MODEL_ALIAS_AUTO,
        GEMINI_MODEL_ALIAS_FLASH,
        false,
        false,
        true,
        undefined,
        true,
      ),
    ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
  });

  it('should resolve auto to gemini-3.5-flash when useGemini3_5Flash is true and classifier selects flash (dynamic)', () => {
    const mockDynamicConfig = {
      getExperimentalDynamicModelConfiguration: () => true,
      modelConfigService,
    } as unknown as Config;

    expect(
      resolveClassifierModel(
        GEMINI_MODEL_ALIAS_AUTO,
        GEMINI_MODEL_ALIAS_FLASH,
        false,
        false,
        true,
        mockDynamicConfig,
        true,
      ),
    ).toBe('gemini-3.5-flash');
  });

  describe('Flash model promotion and manual override routing logic', () => {
    it('should resolve flash alias to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (static)', () => {
      expect(
        resolveModel(
          GEMINI_MODEL_ALIAS_FLASH,
          false,
          false,
          true,
          undefined,
          true,
        ),
      ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    });

    it('should resolve flash alias to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
      const mockDynamicConfig = {
        getExperimentalDynamicModelConfiguration: () => true,
        modelConfigService,
      } as unknown as Config;

      expect(
        resolveModel(
          GEMINI_MODEL_ALIAS_FLASH,
          false,
          false,
          true,
          mockDynamicConfig,
          true,
        ),
      ).toBe('gemini-3.5-flash');
    });

    it('should resolve manual selection of gemini-3-flash-preview to gemini-3-flash-preview when useGemini3_5Flash is true and has preview access (static)', () => {
      expect(
        resolveModel(
          PREVIEW_GEMINI_FLASH_MODEL,
          false,
          false,
          true,
          undefined,
          true,
        ),
      ).toBe('gemini-3-flash-preview');
    });

    it('should resolve manual selection of gemini-3-flash-preview to gemini-3-flash-preview when useGemini3_5Flash is true and has preview access (dynamic)', () => {
      const mockDynamicConfig = {
        getExperimentalDynamicModelConfiguration: () => true,
        modelConfigService,
      } as unknown as Config;

      expect(
        resolveModel(
          PREVIEW_GEMINI_FLASH_MODEL,
          false,
          false,
          true,
          mockDynamicConfig,
          true,
        ),
      ).toBe('gemini-3-flash-preview');
    });

    it('should resolve manual selection of gemini-3-flash-preview to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true but lacks preview access (static)', () => {
      expect(
        resolveModel(
          PREVIEW_GEMINI_FLASH_MODEL,
          false,
          false,
          false,
          undefined,
          true,
        ),
      ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    });

    it('should resolve manual selection of gemini-3-flash-preview to gemini-3.5-flash when useGemini3_5Flash is true but lacks preview access (dynamic)', () => {
      const mockDynamicConfig = {
        getExperimentalDynamicModelConfiguration: () => true,
        modelConfigService,
      } as unknown as Config;

      expect(
        resolveModel(
          PREVIEW_GEMINI_FLASH_MODEL,
          false,
          false,
          false,
          mockDynamicConfig,
          true,
        ),
      ).toBe('gemini-3.5-flash');
    });

    it('should resolve classifier-selected flash alias to DEFAULT_GEMINI_FLASH_MODEL when useGemini3_5Flash is true (static)', () => {
      expect(
        resolveClassifierModel(
          GEMINI_MODEL_ALIAS_AUTO,
          GEMINI_MODEL_ALIAS_FLASH,
          false,
          false,
          true,
          undefined,
          true,
        ),
      ).toBe(DEFAULT_GEMINI_FLASH_MODEL);
    });

    it('should resolve classifier-selected flash alias to gemini-3.5-flash when useGemini3_5Flash is true (dynamic)', () => {
      const mockDynamicConfig = {
        getExperimentalDynamicModelConfiguration: () => true,
        modelConfigService,
      } as unknown as Config;

      expect(
        resolveClassifierModel(
          GEMINI_MODEL_ALIAS_AUTO,
          GEMINI_MODEL_ALIAS_FLASH,
          false,
          false,
          true,
          mockDynamicConfig,
          true,
        ),
      ).toBe('gemini-3.5-flash');
    });

    it('should resolve auto to PREVIEW_GEMINI_MODEL when useGemini3_5Flash is true and has preview access', () => {
      expect(
        resolveModel(
          GEMINI_MODEL_ALIAS_AUTO,
          false,
          false,
          true, // hasAccessToPreview
          undefined,
          true, // useGemini3_5Flash
        ),
      ).toBe(PREVIEW_GEMINI_MODEL);
    });
  });
});