@@ -71,7 +71,7 @@ describe("ToolsTab", () => {
7171 // Switch to second tool
7272 rerender (
7373 < Tabs defaultValue = "tools" >
74- < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 1 ] } />
74+ < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 2 ] } />
7575 </ Tabs > ,
7676 ) ;
7777
@@ -82,25 +82,24 @@ describe("ToolsTab", () => {
8282
8383 it ( "should handle integer type inputs" , ( ) => {
8484 renderToolsTab ( {
85- selectedTool : mockTools [ 2 ] ,
85+ selectedTool : mockTools [ 1 ] , // Use the tool with integer type
8686 } ) ;
8787
8888 // Verify input is rendered as a number input
8989 const input = screen . getByRole ( "spinbutton" ) as HTMLInputElement ;
90- expect ( input . type ) . toBe ( "text " ) ; // This will fail - should be " number"
90+ expect ( input . type ) . toBe ( "number " ) ; // Integer type should be treated as number
9191
9292 // Enter an integer value
9393 fireEvent . change ( input , { target : { value : "42" } } ) ;
9494 expect ( input . value ) . toBe ( "42" ) ;
9595
9696 // Verify the callTool function receives the value as a number
97- const submitButton = screen . getByRole ( "button" , { name : / s u b m i t / i } ) ;
97+ const submitButton = screen . getByRole ( "button" , { name : / r u n t o o l / i } ) ;
9898 fireEvent . click ( submitButton ) ;
9999
100100 expect ( defaultProps . callTool ) . toHaveBeenCalledWith (
101- mockTools [ 2 ] . name ,
102- { count : 42 } , // Should be number 42, not string "42"
103- expect . any ( Function )
101+ mockTools [ 1 ] . name ,
102+ { count : 42 }
104103 ) ;
105104 } ) ;
106105} ) ;
0 commit comments