@@ -265,8 +265,11 @@ describe("CodeIndexSettings", () => {
265265 // Use fireEvent to trigger the change
266266 fireEvent . change ( baseUrlField ! , { target : { value : "test" } } )
267267
268- // Check that setApiConfigurationField was called with the right parameter name (accepts any value)
269- expect ( mockSetApiConfigurationField ) . toHaveBeenCalledWith ( "codebaseIndexOpenAiCompatibleBaseUrl" , "test" )
268+ // Check that setCachedStateField was called with the right parameter name (accepts any value)
269+ expect ( mockSetCachedStateField ) . toHaveBeenCalledWith ( "codebaseIndexConfig" , {
270+ ...openAICompatibleProps . codebaseIndexConfig ,
271+ codebaseIndexOpenAiCompatibleBaseUrl : "test" ,
272+ } )
270273 } )
271274
272275 it ( "should call setApiConfigurationField when API key changes" , async ( ) => {
@@ -290,8 +293,8 @@ describe("CodeIndexSettings", () => {
290293 it ( "should display current base URL value" , ( ) => {
291294 const propsWithValues = {
292295 ...openAICompatibleProps ,
293- apiConfiguration : {
294- ...openAICompatibleProps . apiConfiguration ,
296+ codebaseIndexConfig : {
297+ ...openAICompatibleProps . codebaseIndexConfig ,
295298 codebaseIndexOpenAiCompatibleBaseUrl : "https://existing-api.example.com/v1" ,
296299 } ,
297300 }
@@ -339,7 +342,7 @@ describe("CodeIndexSettings", () => {
339342 expect ( screen . queryByText ( "Embedding Dimension" ) ) . not . toBeInTheDocument ( )
340343 } )
341344
342- it ( "should call setApiConfigurationField when embedding dimension changes" , async ( ) => {
345+ it ( "should call setCachedStateField when embedding dimension changes" , async ( ) => {
343346 const propsWithOpenAICompatible = {
344347 ...defaultProps ,
345348 codebaseIndexConfig : {
@@ -357,11 +360,11 @@ describe("CodeIndexSettings", () => {
357360 // Use fireEvent to trigger the change
358361 fireEvent . change ( dimensionField ! , { target : { value : "1024" } } )
359362
360- // Check that setApiConfigurationField was called with the right parameter name
361- expect ( mockSetApiConfigurationField ) . toHaveBeenCalledWith (
362- "codebaseIndexOpenAiCompatibleModelDimension" ,
363- 1024 ,
364- )
363+ // Check that setCachedStateField was called with the right parameter name
364+ expect ( mockSetCachedStateField ) . toHaveBeenCalledWith ( "codebaseIndexConfig" , {
365+ ... propsWithOpenAICompatible . codebaseIndexConfig ,
366+ codebaseIndexOpenAiCompatibleModelDimension : 1024 ,
367+ } )
365368 } )
366369
367370 it ( "should display current embedding dimension value" , ( ) => {
@@ -370,9 +373,6 @@ describe("CodeIndexSettings", () => {
370373 codebaseIndexConfig : {
371374 ...defaultProps . codebaseIndexConfig ,
372375 codebaseIndexEmbedderProvider : "openai-compatible" as const ,
373- } ,
374- apiConfiguration : {
375- ...defaultProps . apiConfiguration ,
376376 codebaseIndexOpenAiCompatibleModelDimension : 2048 ,
377377 } ,
378378 }
@@ -419,19 +419,21 @@ describe("CodeIndexSettings", () => {
419419 // Test that the field is a text input (implementation uses text with validation logic)
420420 expect ( dimensionField ) . toHaveAttribute ( "type" , "text" )
421421
422- // Test that invalid input (non-numeric) doesn't trigger setApiConfigurationField
422+ // Test that invalid input (non-numeric) doesn't trigger setCachedStateField
423423 fireEvent . change ( dimensionField ! , { target : { value : "invalid" } } )
424-
425- // The implementation only accepts valid numbers
426- // Verify that setApiConfigurationField was not called with invalid string values
427- expect ( mockSetApiConfigurationField ) . not . toHaveBeenCalledWith (
428- "codebaseIndexOpenAiCompatibleModelDimension" ,
429- "invalid" ,
424+ expect ( mockSetCachedStateField ) . not . toHaveBeenCalledWith (
425+ "codebaseIndexConfig" ,
426+ expect . objectContaining ( {
427+ codebaseIndexOpenAiCompatibleModelDimension : "invalid" ,
428+ } ) ,
430429 )
431430
432431 // Test that numeric values (including negative) are accepted by the current implementation
433432 fireEvent . change ( dimensionField ! , { target : { value : "-5" } } )
434- expect ( mockSetApiConfigurationField ) . toHaveBeenCalledWith ( "codebaseIndexOpenAiCompatibleModelDimension" , - 5 )
433+ expect ( mockSetCachedStateField ) . toHaveBeenCalledWith ( "codebaseIndexConfig" , {
434+ ...propsWithOpenAICompatible . codebaseIndexConfig ,
435+ codebaseIndexOpenAiCompatibleModelDimension : - 5 ,
436+ } )
435437 } )
436438 } )
437439
0 commit comments