diff options
| author | Jacob Richman <[email protected]> | 2025-07-18 17:30:28 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-19 00:30:28 +0000 |
| commit | f650be2c3ab5084958952ff14d2235ac14f777ea (patch) | |
| tree | f302c514918eaf5d48f07b9c1bd65c480dd7e8a6 /packages/cli/src/ui/hooks/shellCommandProcessor.test.ts | |
| parent | 4dbd9f30b6df879661e968e493f817667954bfce (diff) | |
Make shell output consistent. (#4469)
Diffstat (limited to 'packages/cli/src/ui/hooks/shellCommandProcessor.test.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/shellCommandProcessor.test.ts | 35 |
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', + }), + ], }); }); }); |
