@@ -16,3 +16,85 @@ func TestWithXAIBuiltinsIncludesVideoPreviewModel(t *testing.T) {
1616
1717 t .Fatalf ("expected xAI builtin model %s" , xaiBuiltinVideo15PreviewModelID )
1818}
19+
20+ func TestIsAntigravityWebSearchModelUsesRuntimeCapability (t * testing.T ) {
21+ registryRef := GetGlobalRegistry ()
22+ registryRef .RegisterClient ("test-antigravity-websearch" , "antigravity" , []* ModelInfo {
23+ {ID : "gemini-web-search-test" , SupportsWebSearch : true },
24+ {ID : "gemini-web-search-disabled" , SupportsWebSearch : false },
25+ })
26+ registryRef .RegisterClient ("test-gemini-websearch" , "gemini" , []* ModelInfo {
27+ {ID : "gemini-web-search-cross-provider" , SupportsWebSearch : true },
28+ })
29+ t .Cleanup (func () {
30+ registryRef .UnregisterClient ("test-antigravity-websearch" )
31+ registryRef .UnregisterClient ("test-gemini-websearch" )
32+ })
33+
34+ if ! IsAntigravityWebSearchModel ("gemini-web-search-test" ) {
35+ t .Fatal ("runtime Antigravity web search model should be marked capable" )
36+ }
37+ if ! IsAntigravityWebSearchModel ("gemini-web-search-test(high)" ) {
38+ t .Fatal ("thinking suffix should not hide Antigravity web search capability" )
39+ }
40+ if IsAntigravityWebSearchModel ("gemini-web-search-disabled" ) {
41+ t .Fatal ("Antigravity model without web search support should not be marked capable" )
42+ }
43+ if IsAntigravityWebSearchModel ("gemini-web-search-cross-provider" ) {
44+ t .Fatal ("same capability on another provider should not mark Antigravity capable" )
45+ }
46+ }
47+
48+ func TestAntigravityWebSearchModelsUsesRuntimeCapability (t * testing.T ) {
49+ registryRef := GetGlobalRegistry ()
50+ registryRef .RegisterClient ("test-antigravity-websearch-list" , "antigravity" , []* ModelInfo {
51+ {ID : "gemini-web-search-test" , SupportsWebSearch : true },
52+ {ID : "gemini-web-search-disabled" , SupportsWebSearch : false },
53+ })
54+ t .Cleanup (func () {
55+ registryRef .UnregisterClient ("test-antigravity-websearch-list" )
56+ })
57+
58+ models := AntigravityWebSearchModels ()
59+ if len (models ) == 0 {
60+ t .Fatal ("expected at least one Antigravity web search model" )
61+ }
62+ for _ , model := range models {
63+ if model == "gemini-web-search-test" {
64+ return
65+ }
66+ }
67+ t .Fatalf ("AntigravityWebSearchModels() = %#v, want gemini-web-search-test" , models )
68+ }
69+
70+ func TestAntigravityWebSearchModelForRequiresRequestedModelCapability (t * testing.T ) {
71+ registryRef := GetGlobalRegistry ()
72+ registryRef .RegisterClient ("test-antigravity-websearch-route" , "antigravity" , []* ModelInfo {
73+ {ID : "gemini-route-test" },
74+ {ID : "gemini-web-search-test" , SupportsWebSearch : true },
75+ })
76+ registryRef .RegisterClient ("test-gemini-websearch-route" , "gemini" , []* ModelInfo {
77+ {ID : "gemini-cross-provider-route" },
78+ {ID : "gemini-cross-provider-search" , SupportsWebSearch : true },
79+ })
80+ t .Cleanup (func () {
81+ registryRef .UnregisterClient ("test-antigravity-websearch-route" )
82+ registryRef .UnregisterClient ("test-gemini-websearch-route" )
83+ })
84+
85+ if got := AntigravityWebSearchModelFor ("gemini-route-test" ); got != "" {
86+ t .Fatalf ("route model without web search support should not get fallback model, got %q" , got )
87+ }
88+ if got := AntigravityWebSearchModelFor ("gemini-route-test(high)" ); got != "" {
89+ t .Fatalf ("suffix route model without web search support should not get fallback model, got %q" , got )
90+ }
91+ if got := AntigravityWebSearchModelFor ("gemini-web-search-test" ); got != "gemini-web-search-test" {
92+ t .Fatalf ("AntigravityWebSearchModelFor capable model = %q, want itself" , got )
93+ }
94+ if got := AntigravityWebSearchModelFor ("gemini-cross-provider-route" ); got != "" {
95+ t .Fatalf ("cross-provider model should not get Antigravity web search model, got %q" , got )
96+ }
97+ if got := AntigravityWebSearchModelFor ("unknown-model" ); got != "" {
98+ t .Fatalf ("unknown model should not get Antigravity web search model, got %q" , got )
99+ }
100+ }
0 commit comments