@@ -47,6 +47,7 @@ describe("Vertex", () => {
4747 vertexRegion : "" ,
4848 enableUrlContext : false ,
4949 enableGrounding : false ,
50+ apiModelId : "gemini-2.0-flash-001" ,
5051 }
5152
5253 const mockSetApiConfigurationField = vi . fn ( )
@@ -113,7 +114,7 @@ describe("Vertex", () => {
113114 } )
114115
115116 describe ( "URL Context Checkbox" , ( ) => {
116- it ( "should render URL context checkbox unchecked by default" , ( ) => {
117+ it ( "should render URL context checkbox unchecked by default for Gemini models " , ( ) => {
117118 render (
118119 < Vertex
119120 apiConfiguration = { defaultApiConfiguration }
@@ -126,8 +127,35 @@ describe("Vertex", () => {
126127 expect ( checkbox . checked ) . toBe ( false )
127128 } )
128129
129- it ( "should render URL context checkbox checked when enableUrlContext is true" , ( ) => {
130- const apiConfiguration = { ...defaultApiConfiguration , enableUrlContext : true }
130+ it ( "should NOT render URL context checkbox for non-Gemini models" , ( ) => {
131+ const apiConfiguration = { ...defaultApiConfiguration , apiModelId : "claude-3-opus@20240229" }
132+ render (
133+ < Vertex apiConfiguration = { apiConfiguration } setApiConfigurationField = { mockSetApiConfigurationField } /> ,
134+ )
135+
136+ const urlContextCheckbox = screen . queryByTestId ( "checkbox-url-context" )
137+ expect ( urlContextCheckbox ) . toBeNull ( )
138+ } )
139+
140+ it ( "should NOT render URL context checkbox when fromWelcomeView is true" , ( ) => {
141+ render (
142+ < Vertex
143+ apiConfiguration = { defaultApiConfiguration }
144+ setApiConfigurationField = { mockSetApiConfigurationField }
145+ fromWelcomeView = { true }
146+ /> ,
147+ )
148+
149+ const urlContextCheckbox = screen . queryByTestId ( "checkbox-url-context" )
150+ expect ( urlContextCheckbox ) . toBeNull ( )
151+ } )
152+
153+ it ( "should render URL context checkbox checked when enableUrlContext is true for Gemini models" , ( ) => {
154+ const apiConfiguration = {
155+ ...defaultApiConfiguration ,
156+ enableUrlContext : true ,
157+ apiModelId : "gemini-2.0-flash-001" ,
158+ }
131159 render (
132160 < Vertex apiConfiguration = { apiConfiguration } setApiConfigurationField = { mockSetApiConfigurationField } /> ,
133161 )
@@ -156,7 +184,7 @@ describe("Vertex", () => {
156184 } )
157185
158186 describe ( "Grounding with Google Search Checkbox" , ( ) => {
159- it ( "should render grounding search checkbox unchecked by default" , ( ) => {
187+ it ( "should render grounding search checkbox unchecked by default for Gemini models " , ( ) => {
160188 render (
161189 < Vertex
162190 apiConfiguration = { defaultApiConfiguration }
@@ -169,8 +197,35 @@ describe("Vertex", () => {
169197 expect ( checkbox . checked ) . toBe ( false )
170198 } )
171199
172- it ( "should render grounding search checkbox checked when enableGrounding is true" , ( ) => {
173- const apiConfiguration = { ...defaultApiConfiguration , enableGrounding : true }
200+ it ( "should NOT render grounding search checkbox for non-Gemini models" , ( ) => {
201+ const apiConfiguration = { ...defaultApiConfiguration , apiModelId : "claude-3-opus@20240229" }
202+ render (
203+ < Vertex apiConfiguration = { apiConfiguration } setApiConfigurationField = { mockSetApiConfigurationField } /> ,
204+ )
205+
206+ const groundingCheckbox = screen . queryByTestId ( "checkbox-grounding-search" )
207+ expect ( groundingCheckbox ) . toBeNull ( )
208+ } )
209+
210+ it ( "should NOT render grounding search checkbox when fromWelcomeView is true" , ( ) => {
211+ render (
212+ < Vertex
213+ apiConfiguration = { defaultApiConfiguration }
214+ setApiConfigurationField = { mockSetApiConfigurationField }
215+ fromWelcomeView = { true }
216+ /> ,
217+ )
218+
219+ const groundingCheckbox = screen . queryByTestId ( "checkbox-grounding-search" )
220+ expect ( groundingCheckbox ) . toBeNull ( )
221+ } )
222+
223+ it ( "should render grounding search checkbox checked when enableGrounding is true for Gemini models" , ( ) => {
224+ const apiConfiguration = {
225+ ...defaultApiConfiguration ,
226+ enableGrounding : true ,
227+ apiModelId : "gemini-2.0-flash-001" ,
228+ }
174229 render (
175230 < Vertex apiConfiguration = { apiConfiguration } setApiConfigurationField = { mockSetApiConfigurationField } /> ,
176231 )
0 commit comments