summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks/shellCommandProcessor.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/shellCommandProcessor.test.ts35
1 files changed, 29 insertions, 6 deletions
diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
index 4549f929..53dcb0d4 100644
--- a/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/shellCommandProcessor.test.ts
@@ -10,6 +10,7 @@ import { useShellCommandProcessor } from './shellCommandProcessor';
import { Config, GeminiClient } from '@google/gemini-cli-core';
import * as fs from 'fs';
import EventEmitter from 'events';
+import { ToolCallStatus } from '../types';
// Mock dependencies
vi.mock('child_process');
@@ -104,8 +105,15 @@ describe('useShellCommandProcessor', () => {
expect(addItemToHistoryMock).toHaveBeenCalledTimes(2);
expect(addItemToHistoryMock.mock.calls[1][0]).toEqual({
- type: 'info',
- text: 'file1.txt\nfile2.txt',
+ type: 'tool_group',
+ tools: [
+ expect.objectContaining({
+ name: 'Shell Command',
+ description: 'ls -l',
+ status: ToolCallStatus.Success,
+ resultDisplay: 'file1.txt\nfile2.txt',
+ }),
+ ],
});
expect(geminiClientMock.addHistory).toHaveBeenCalledTimes(1);
});
@@ -140,8 +148,16 @@ describe('useShellCommandProcessor', () => {
expect(addItemToHistoryMock).toHaveBeenCalledTimes(2);
expect(addItemToHistoryMock.mock.calls[1][0]).toEqual({
- type: 'info',
- text: '[Command produced binary output, which is not shown.]',
+ type: 'tool_group',
+ tools: [
+ expect.objectContaining({
+ name: 'Shell Command',
+ description: 'cat myimage.png',
+ status: ToolCallStatus.Success,
+ resultDisplay:
+ '[Command produced binary output, which is not shown.]',
+ }),
+ ],
});
});
@@ -172,8 +188,15 @@ describe('useShellCommandProcessor', () => {
expect(addItemToHistoryMock).toHaveBeenCalledTimes(2);
expect(addItemToHistoryMock.mock.calls[1][0]).toEqual({
- type: 'error',
- text: 'Command exited with code 127.\ncommand not found',
+ type: 'tool_group',
+ tools: [
+ expect.objectContaining({
+ name: 'Shell Command',
+ description: 'a-bad-command',
+ status: ToolCallStatus.Error,
+ resultDisplay: 'Command exited with code 127.\ncommand not found',
+ }),
+ ],
});
});
});