@@ -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" ,
@@ -61,12 +71,32 @@ describe("ToolsTab", () => {
6171 // Switch to second tool
6272 rerender (
6373 < Tabs defaultValue = "tools" >
64- < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 1 ] } />
74+ < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 2 ] } />
6575 </ Tabs > ,
6676 ) ;
6777
6878 // Verify input is reset
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 [ 1 ] , // Use the tool with integer type
86+ } ) ;
87+
88+ const input = screen . getByRole ( "spinbutton" , {
89+ name : / c o u n t / i,
90+ } ) as HTMLInputElement ;
91+ expect ( input ) . toHaveProperty ( "type" , "number" ) ;
92+ fireEvent . change ( input , { target : { value : "42" } } ) ;
93+ expect ( input . value ) . toBe ( "42" ) ;
94+
95+ const submitButton = screen . getByRole ( "button" , { name : / r u n t o o l / i } ) ;
96+ fireEvent . click ( submitButton ) ;
97+
98+ expect ( defaultProps . callTool ) . toHaveBeenCalledWith ( mockTools [ 1 ] . name , {
99+ count : 42 ,
100+ } ) ;
101+ } ) ;
72102} ) ;
0 commit comments