@@ -16,6 +16,16 @@ describe("ToolsTab", () => {
1616 } ,
1717 } ,
1818 } ,
19+ {
20+ name : "tool3" ,
21+ description : "Integer tool" ,
22+ inputSchema : {
23+ type : "object" as const ,
24+ properties : {
25+ count : { type : "integer" as const } ,
26+ } ,
27+ } ,
28+ } ,
1929 {
2030 name : "tool2" ,
2131 description : "Second tool" ,
@@ -69,4 +79,28 @@ describe("ToolsTab", () => {
6979 const newInput = screen . getByRole ( "spinbutton" ) as HTMLInputElement ;
7080 expect ( newInput . value ) . toBe ( "" ) ;
7181 } ) ;
82+
83+ it ( "should handle integer type inputs" , ( ) => {
84+ renderToolsTab ( {
85+ selectedTool : mockTools [ 2 ] ,
86+ } ) ;
87+
88+ // Verify input is rendered as a number input
89+ const input = screen . getByRole ( "spinbutton" ) as HTMLInputElement ;
90+ expect ( input . type ) . toBe ( "text" ) ; // This will fail - should be "number"
91+
92+ // Enter an integer value
93+ fireEvent . change ( input , { target : { value : "42" } } ) ;
94+ expect ( input . value ) . toBe ( "42" ) ;
95+
96+ // Verify the callTool function receives the value as a number
97+ const submitButton = screen . getByRole ( "button" , { name : / s u b m i t / i } ) ;
98+ fireEvent . click ( submitButton ) ;
99+
100+ expect ( defaultProps . callTool ) . toHaveBeenCalledWith (
101+ mockTools [ 2 ] . name ,
102+ { count : 42 } , // Should be number 42, not string "42"
103+ expect . any ( Function )
104+ ) ;
105+ } ) ;
72106} ) ;
0 commit comments