@@ -498,7 +498,13 @@ describe("command-executor", () => {
498498
499499 executeTerminalCommand ( button , mockTerminalExecutor ) ;
500500
501- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo test" , false , undefined , "Test Button" , expect . objectContaining ( { command : "echo test" , name : "Test Button" } ) ) ;
501+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
502+ "echo test" ,
503+ false ,
504+ undefined ,
505+ "Test Button" ,
506+ expect . objectContaining ( { command : "echo test" , name : "Test Button" } )
507+ ) ;
502508 } ) ;
503509
504510 it ( "should call terminalExecutor with useVsCodeApi true" , ( ) => {
@@ -511,7 +517,13 @@ describe("command-executor", () => {
511517
512518 executeTerminalCommand ( button , mockTerminalExecutor ) ;
513519
514- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo test" , true , undefined , "Test Button" , expect . objectContaining ( { command : "echo test" , name : "Test Button" , useVsCodeApi : true } ) ) ;
520+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
521+ "echo test" ,
522+ true ,
523+ undefined ,
524+ "Test Button" ,
525+ expect . objectContaining ( { command : "echo test" , name : "Test Button" , useVsCodeApi : true } )
526+ ) ;
515527 } ) ;
516528
517529 it ( "should call terminalExecutor with custom terminal name" , ( ) => {
@@ -524,7 +536,17 @@ describe("command-executor", () => {
524536
525537 executeTerminalCommand ( button , mockTerminalExecutor ) ;
526538
527- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo test" , false , "Custom Terminal" , "Test Button" , expect . objectContaining ( { command : "echo test" , name : "Test Button" , terminalName : "Custom Terminal" } ) ) ;
539+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
540+ "echo test" ,
541+ false ,
542+ "Custom Terminal" ,
543+ "Test Button" ,
544+ expect . objectContaining ( {
545+ command : "echo test" ,
546+ name : "Test Button" ,
547+ terminalName : "Custom Terminal" ,
548+ } )
549+ ) ;
528550 } ) ;
529551
530552 it ( "should call terminalExecutor with all parameters" , ( ) => {
@@ -538,7 +560,18 @@ describe("command-executor", () => {
538560
539561 executeTerminalCommand ( button , mockTerminalExecutor ) ;
540562
541- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo test" , true , "Custom Terminal" , "Test Button" , expect . objectContaining ( { command : "echo test" , name : "Test Button" , terminalName : "Custom Terminal" , useVsCodeApi : true } ) ) ;
563+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
564+ "echo test" ,
565+ true ,
566+ "Custom Terminal" ,
567+ "Test Button" ,
568+ expect . objectContaining ( {
569+ command : "echo test" ,
570+ name : "Test Button" ,
571+ terminalName : "Custom Terminal" ,
572+ useVsCodeApi : true ,
573+ } )
574+ ) ;
542575 } ) ;
543576
544577 it ( "should not call terminalExecutor when command is undefined" , ( ) => {
@@ -588,8 +621,20 @@ describe("command-executor", () => {
588621 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
589622
590623 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 3 ) ;
591- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 1 , "echo test1" , false , undefined , "Command 1[0]" ) ;
592- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 2 , "echo test2" , true , undefined , "Command 2[1]" ) ;
624+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
625+ 1 ,
626+ "echo test1" ,
627+ false ,
628+ undefined ,
629+ "Command 1[0]"
630+ ) ;
631+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
632+ 2 ,
633+ "echo test2" ,
634+ true ,
635+ undefined ,
636+ "Command 2[1]"
637+ ) ;
593638 expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
594639 3 ,
595640 "echo test3" ,
@@ -622,8 +667,20 @@ describe("command-executor", () => {
622667 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
623668
624669 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 2 ) ;
625- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 1 , "echo child1" , false , undefined , "Group Command[0]>Child 1[0]" ) ;
626- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 2 , "echo child2" , true , undefined , "Group Command[0]>Child 2[1]" ) ;
670+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
671+ 1 ,
672+ "echo child1" ,
673+ false ,
674+ undefined ,
675+ "Group Command[0]>Child 1[0]"
676+ ) ;
677+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
678+ 2 ,
679+ "echo child2" ,
680+ true ,
681+ undefined ,
682+ "Group Command[0]>Child 2[1]"
683+ ) ;
627684 } ) ;
628685
629686 it ( "should not execute commands for buttons with groups but no executeAll flag" , ( ) => {
@@ -674,8 +731,20 @@ describe("command-executor", () => {
674731 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
675732
676733 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 2 ) ;
677- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 1 , "echo level3" , false , undefined , "Level 1 Group[0]>Level 2 Group[0]>Level 3 Command[0]" ) ;
678- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 2 , "echo level2" , false , undefined , "Level 1 Group[0]>Level 2 Command[1]" ) ;
734+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
735+ 1 ,
736+ "echo level3" ,
737+ false ,
738+ undefined ,
739+ "Level 1 Group[0]>Level 2 Group[0]>Level 3 Command[0]"
740+ ) ;
741+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
742+ 2 ,
743+ "echo level2" ,
744+ false ,
745+ undefined ,
746+ "Level 1 Group[0]>Level 2 Command[1]"
747+ ) ;
679748 } ) ;
680749
681750 it ( "should skip buttons without commands and without groups" , ( ) => {
@@ -693,7 +762,12 @@ describe("command-executor", () => {
693762 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
694763
695764 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 1 ) ;
696- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo valid" , false , undefined , "Valid Command[0]" ) ;
765+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
766+ "echo valid" ,
767+ false ,
768+ undefined ,
769+ "Valid Command[0]"
770+ ) ;
697771 } ) ;
698772
699773 it ( "should skip buttons with empty command strings" , ( ) => {
@@ -712,7 +786,12 @@ describe("command-executor", () => {
712786 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
713787
714788 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 1 ) ;
715- expect ( mockTerminalExecutor ) . toHaveBeenCalledWith ( "echo valid" , false , undefined , "Valid Command[0]" ) ;
789+ expect ( mockTerminalExecutor ) . toHaveBeenCalledWith (
790+ "echo valid" ,
791+ false ,
792+ undefined ,
793+ "Valid Command[0]"
794+ ) ;
716795 } ) ;
717796
718797 it ( "should handle empty commands array" , ( ) => {
@@ -759,8 +838,20 @@ describe("command-executor", () => {
759838 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
760839
761840 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 2 ) ;
762- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 1 , "echo regular" , false , undefined , "Regular Command[0]" ) ;
763- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 2 , "echo child" , false , undefined , "Group with executeAll[1]>Child Command[0]" ) ;
841+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
842+ 1 ,
843+ "echo regular" ,
844+ false ,
845+ undefined ,
846+ "Regular Command[0]"
847+ ) ;
848+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
849+ 2 ,
850+ "echo child" ,
851+ false ,
852+ undefined ,
853+ "Group with executeAll[1]>Child Command[0]"
854+ ) ;
764855 } ) ;
765856
766857 it ( "should handle complex nested structure with mixed executeAll flags" , ( ) => {
@@ -805,9 +896,27 @@ describe("command-executor", () => {
805896 executeCommandsRecursively ( commands , mockTerminalExecutor ) ;
806897
807898 expect ( mockTerminalExecutor ) . toHaveBeenCalledTimes ( 3 ) ;
808- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 1 , "echo leaf1" , false , undefined , "Root Group[0]>Branch 1[0]>Leaf 1[0]" ) ;
809- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 2 , "echo leaf2" , false , undefined , "Root Group[0]>Branch 1[0]>Leaf 2[1]" ) ;
810- expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith ( 3 , "echo direct" , false , undefined , "Root Group[0]>Direct Command[2]" ) ;
899+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
900+ 1 ,
901+ "echo leaf1" ,
902+ false ,
903+ undefined ,
904+ "Root Group[0]>Branch 1[0]>Leaf 1[0]"
905+ ) ;
906+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
907+ 2 ,
908+ "echo leaf2" ,
909+ false ,
910+ undefined ,
911+ "Root Group[0]>Branch 1[0]>Leaf 2[1]"
912+ ) ;
913+ expect ( mockTerminalExecutor ) . toHaveBeenNthCalledWith (
914+ 3 ,
915+ "echo direct" ,
916+ false ,
917+ undefined ,
918+ "Root Group[0]>Direct Command[2]"
919+ ) ;
811920 } ) ;
812921 } ) ;
813922} ) ;
0 commit comments