@@ -16,6 +16,16 @@ describe("ToolsTab", () => {
16
16
} ,
17
17
} ,
18
18
} ,
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
+ } ,
19
29
{
20
30
name : "tool2" ,
21
31
description : "Second tool" ,
@@ -61,12 +71,32 @@ describe("ToolsTab", () => {
61
71
// Switch to second tool
62
72
rerender (
63
73
< Tabs defaultValue = "tools" >
64
- < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 1 ] } />
74
+ < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 2 ] } />
65
75
</ Tabs > ,
66
76
) ;
67
77
68
78
// Verify input is reset
69
79
const newInput = screen . getByRole ( "spinbutton" ) as HTMLInputElement ;
70
80
expect ( newInput . value ) . toBe ( "" ) ;
71
81
} ) ;
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
+ } ) ;
72
102
} ) ;
0 commit comments