diff options
Diffstat (limited to 'packages/core/src/tools/shell.test.ts')
| -rw-r--r-- | packages/core/src/tools/shell.test.ts | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/packages/core/src/tools/shell.test.ts b/packages/core/src/tools/shell.test.ts index acc8c01f..a4d56e22 100644 --- a/packages/core/src/tools/shell.test.ts +++ b/packages/core/src/tools/shell.test.ts @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { expect, describe, it } from 'vitest'; +import { expect, describe, it, vi, beforeEach } from 'vitest'; import { ShellTool } from './shell.js'; import { Config } from '../config/config.js'; +import * as summarizer from '../utils/summarizer.js'; +import { GeminiClient } from '../core/client.js'; describe('ShellTool', () => { it('should allow a command if no restrictions are provided', async () => { @@ -396,3 +398,35 @@ describe('ShellTool', () => { ); }); }); + +describe('ShellTool Bug Reproduction', () => { + let shellTool: ShellTool; + let config: Config; + + beforeEach(() => { + config = { + getCoreTools: () => undefined, + getExcludeTools: () => undefined, + getDebugMode: () => false, + getGeminiClient: () => ({}) as GeminiClient, + getTargetDir: () => '.', + } as unknown as Config; + shellTool = new ShellTool(config); + }); + + it('should not let the summarizer override the return display', async () => { + const summarizeSpy = vi + .spyOn(summarizer, 'summarizeToolOutput') + .mockResolvedValue('summarized output'); + + const abortSignal = new AbortController().signal; + const result = await shellTool.execute( + { command: 'echo "hello"' }, + abortSignal, + ); + + expect(result.returnDisplay).toBe('hello\n'); + expect(result.llmContent).toBe('summarized output'); + expect(summarizeSpy).toHaveBeenCalled(); + }); +}); |
