@@ -71,7 +71,7 @@ describe("ToolsTab", () => {
71
71
// Switch to second tool
72
72
rerender (
73
73
< Tabs defaultValue = "tools" >
74
- < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 1 ] } />
74
+ < ToolsTab { ...defaultProps } selectedTool = { mockTools [ 2 ] } />
75
75
</ Tabs > ,
76
76
) ;
77
77
@@ -82,25 +82,24 @@ describe("ToolsTab", () => {
82
82
83
83
it ( "should handle integer type inputs" , ( ) => {
84
84
renderToolsTab ( {
85
- selectedTool : mockTools [ 2 ] ,
85
+ selectedTool : mockTools [ 1 ] , // Use the tool with integer type
86
86
} ) ;
87
87
88
88
// Verify input is rendered as a number input
89
89
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
91
91
92
92
// Enter an integer value
93
93
fireEvent . change ( input , { target : { value : "42" } } ) ;
94
94
expect ( input . value ) . toBe ( "42" ) ;
95
95
96
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 } ) ;
97
+ const submitButton = screen . getByRole ( "button" , { name : / r u n t o o l / i } ) ;
98
98
fireEvent . click ( submitButton ) ;
99
99
100
100
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 }
104
103
) ;
105
104
} ) ;
106
105
} ) ;
0 commit comments