Skip to content

Commit d93f1bd

Browse files
committed
Fix tests
1 parent d423b24 commit d93f1bd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,9 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
899899
const subCommandsToSuggest = Array.from(new Set(unapprovedSubCommands.map(command => {
900900
const parts = command.trim().split(/\s+/);
901901
const baseCommand = parts[0].toLowerCase();
902+
const baseSubCommand = parts.length > 1 ? `${parts[0]} ${parts[1]}`.toLowerCase() : '';
902903

903-
if (commandsWithSubSubCommands.has(baseCommand) && parts.length >= 3) {
904+
if (commandsWithSubSubCommands.has(baseSubCommand) && parts.length >= 3) {
904905
return `${parts[0]} ${parts[1]} ${parts[2]}`;
905906
} else if (commandsWithSubcommands.has(baseCommand) && parts.length >= 2) {
906907
return `${parts[0]} ${parts[1]}`;

src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/runInTerminalTool.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ suite('RunInTerminalTool', () => {
296296

297297

298298
ok(!isSeparator(customActions[0]));
299-
strictEqual(customActions[0].label, 'Always Allow Command: npm');
299+
strictEqual(customActions[0].label, 'Always Allow Command: npm run build');
300300
strictEqual(customActions[0].data.type, 'newRule');
301301
ok(Array.isArray(customActions[0].data.rule), 'Expected rule to be an array');
302302

303303
ok(!isSeparator(customActions[1]));
304-
strictEqual(customActions[1].label, 'Always Allow Full Command Line: npm run build');
304+
strictEqual(customActions[1].label, 'Always Allow Exact Command Line: npm run build');
305305
strictEqual(customActions[1].data.type, 'newRule');
306306
ok(!Array.isArray(customActions[1].data.rule), 'Expected rule to be an object');
307307

@@ -384,11 +384,11 @@ suite('RunInTerminalTool', () => {
384384
strictEqual(customActions.length, 4);
385385

386386
ok(!isSeparator(customActions[0]));
387-
strictEqual(customActions[0].label, 'Always Allow Command: npm install, npm run build');
387+
strictEqual(customActions[0].label, 'Always Allow Commands: npm install, npm run build');
388388
strictEqual(customActions[0].data.type, 'newRule');
389389

390390
ok(!isSeparator(customActions[1]));
391-
strictEqual(customActions[1].label, 'Always Allow Full Command Line: npm install &&& npm run build');
391+
strictEqual(customActions[1].label, 'Always Allow Exact Command Line: npm install &&& npm run build');
392392
strictEqual(customActions[1].data.type, 'newRule');
393393

394394
ok(isSeparator(customActions[2]));
@@ -419,7 +419,7 @@ suite('RunInTerminalTool', () => {
419419
strictEqual(customActions[0].data.type, 'newRule');
420420

421421
ok(!isSeparator(customActions[1]));
422-
strictEqual(customActions[1].label, 'Always Allow Full Command Line: foo | head -20');
422+
strictEqual(customActions[1].label, 'Always Allow Exact Command Line: foo | head -20');
423423
strictEqual(customActions[1].data.type, 'newRule');
424424

425425
ok(isSeparator(customActions[2]));
@@ -465,7 +465,7 @@ suite('RunInTerminalTool', () => {
465465
strictEqual(customActions[0].data.type, 'newRule');
466466

467467
ok(!isSeparator(customActions[1]));
468-
strictEqual(customActions[1].label, 'Always Allow Full Command Line: foo | head -20 &&& bar | tail -10');
468+
strictEqual(customActions[1].label, 'Always Allow Exact Command Line: foo | head -20 &&& bar | tail -10');
469469
strictEqual(customActions[1].data.type, 'newRule');
470470

471471
ok(isSeparator(customActions[2]));

0 commit comments

Comments
 (0)