@@ -724,59 +724,40 @@ suite('RunInTerminalTool', () => {
724724
725725 test ( 'should not suggest subcommand for commands with flags' , async ( ) => {
726726 const result = await executeToolTest ( {
727- command : 'npm --foo --bar' ,
728- explanation : 'Run npm with flags'
727+ command : 'foo --foo --bar' ,
728+ explanation : 'Run foo with flags'
729729 } ) ;
730730
731731 assertConfirmationRequired ( result ) ;
732732 ok ( result ! . confirmationMessages ! . terminalCustomActions , 'Expected custom actions to be defined' ) ;
733733
734734 const customActions = result ! . confirmationMessages ! . terminalCustomActions ! ;
735- // Commands with flags don't get subcommand suggestions, only exact command line
736- strictEqual ( customActions . length , 3 ) ;
737-
738- ok ( ! isSeparator ( customActions [ 0 ] ) ) ;
739- strictEqual ( customActions [ 0 ] . label , 'Always Allow Exact Command Line' ) ;
740- strictEqual ( customActions [ 0 ] . data . type , 'newRule' ) ;
741- ok ( ! Array . isArray ( customActions [ 0 ] . data . rule ) , 'Expected rule to be an object' ) ;
742- } ) ;
743-
744- test ( 'should not suggest subcommand for git commands with flags' , async ( ) => {
745- const result = await executeToolTest ( {
746- command : 'git --version' ,
747- explanation : 'Check git version'
748- } ) ;
749-
750- assertConfirmationRequired ( result ) ;
751- ok ( result ! . confirmationMessages ! . terminalCustomActions , 'Expected custom actions to be defined' ) ;
752-
753- const customActions = result ! . confirmationMessages ! . terminalCustomActions ! ;
754- // Commands with flags don't get subcommand suggestions, only exact command line
755- strictEqual ( customActions . length , 3 ) ;
735+ strictEqual ( customActions . length , 4 ) ;
756736
757737 ok ( ! isSeparator ( customActions [ 0 ] ) ) ;
758- strictEqual ( customActions [ 0 ] . label , 'Always Allow Exact Command Line ' ) ;
738+ strictEqual ( customActions [ 0 ] . label , 'Always Allow Command: foo ' ) ;
759739 strictEqual ( customActions [ 0 ] . data . type , 'newRule' ) ;
760- ok ( ! Array . isArray ( customActions [ 0 ] . data . rule ) , 'Expected rule to be an object' ) ;
740+ ok ( Array . isArray ( customActions [ 0 ] . data . rule ) , 'Expected rule to be an array' ) ;
741+ strictEqual ( ( customActions [ 0 ] . data . rule as any ) [ 0 ] . key , 'foo' ) ;
761742 } ) ;
762743
763744 test ( 'should not suggest subcommand for npm run with flags' , async ( ) => {
764745 const result = await executeToolTest ( {
765- command : 'npm run --some-flag' ,
766- explanation : 'Run npm run with flags'
746+ command : 'npm run abc --some-flag' ,
747+ explanation : 'Run npm run abc with flags'
767748 } ) ;
768749
769750 assertConfirmationRequired ( result ) ;
770751 ok ( result ! . confirmationMessages ! . terminalCustomActions , 'Expected custom actions to be defined' ) ;
771752
772753 const customActions = result ! . confirmationMessages ! . terminalCustomActions ! ;
773- // Commands with flags don't get subcommand suggestions, only exact command line
774- strictEqual ( customActions . length , 3 ) ;
754+ strictEqual ( customActions . length , 4 ) ;
775755
776756 ok ( ! isSeparator ( customActions [ 0 ] ) ) ;
777- strictEqual ( customActions [ 0 ] . label , 'Always Allow Exact Command Line ' ) ;
757+ strictEqual ( customActions [ 0 ] . label , 'Always Allow Command: npm run abc ' ) ;
778758 strictEqual ( customActions [ 0 ] . data . type , 'newRule' ) ;
779- ok ( ! Array . isArray ( customActions [ 0 ] . data . rule ) , 'Expected rule to be an object' ) ;
759+ ok ( Array . isArray ( customActions [ 0 ] . data . rule ) , 'Expected rule to be an array' ) ;
760+ strictEqual ( ( customActions [ 0 ] . data . rule as any ) [ 0 ] . key , 'npm run abc' ) ;
780761 } ) ;
781762
782763 test ( 'should handle mixed npm run and other commands' , async ( ) => {
0 commit comments