@@ -644,6 +644,7 @@ describe("ToolsTab", () => {
644644 description : "Tool with JSON parameters" ,
645645 inputSchema : {
646646 type : "object" as const ,
647+ required : [ "config" , "data" ] , // Make them required so they render as form fields
647648 properties : {
648649 config : {
649650 type : "object" as const ,
@@ -693,15 +694,16 @@ describe("ToolsTab", () => {
693694 callTool : mockCallTool ,
694695 } ) ;
695696
696- // Find JSON editor textareas
697+ // Find JSON editor textareas (should have one for each required field: config and data)
697698 const textareas = screen . getAllByRole ( "textbox" ) ;
699+ expect ( textareas . length ) . toBe ( 2 ) ;
698700
699- // Enter valid JSON in the first textarea
701+ // Enter valid JSON in each textarea
700702 fireEvent . change ( textareas [ 0 ] , {
701- target : {
702- value :
703- '{ "config": { "setting": "value" }, "data": ["item1", "item2"] }' ,
704- } ,
703+ target : { value : '{ "setting": "value" }' } ,
704+ } ) ;
705+ fireEvent . change ( textareas [ 1 ] , {
706+ target : { value : '["item1", "item2"]' } ,
705707 } ) ;
706708
707709 // Wait for debounced updates
@@ -799,9 +801,16 @@ describe("ToolsTab", () => {
799801 } ) ;
800802
801803 const textareas = screen . getAllByRole ( "textbox" ) ;
804+ expect ( textareas . length ) . toBe ( 2 ) ;
805+
806+ // Clear both textareas (empty JSON should be valid)
807+ fireEvent . change ( textareas [ 0 ] , { target : { value : "{}" } } ) ;
808+ fireEvent . change ( textareas [ 1 ] , { target : { value : "[]" } } ) ;
802809
803- // Clear the textarea (empty JSON should be valid)
804- fireEvent . change ( textareas [ 0 ] , { target : { value : "" } } ) ;
810+ // Wait for debounced updates
811+ await act ( async ( ) => {
812+ await new Promise ( ( resolve ) => setTimeout ( resolve , 350 ) ) ;
813+ } ) ;
805814
806815 // Try to run the tool
807816 const runButton = screen . getByRole ( "button" , { name : / r u n t o o l / i } ) ;
0 commit comments