diff options
| author | joshualitt <[email protected]> | 2025-08-21 14:40:18 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-21 21:40:18 +0000 |
| commit | ec41b8db8e714867ea354c29c07f009cd837ac23 (patch) | |
| tree | 4bb01ac90a25d6d82cfc005d68aae336be192744 /packages/core/src/tools/web-search.test.ts | |
| parent | 299bf58309a0950ac81ae051b02ec64463ebd153 (diff) | |
feat(core): Annotate remaining error paths in tools with type. (#6699)
Diffstat (limited to 'packages/core/src/tools/web-search.test.ts')
| -rw-r--r-- | packages/core/src/tools/web-search.test.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/core/src/tools/web-search.test.ts b/packages/core/src/tools/web-search.test.ts index c0620c08..0f7c1d6c 100644 --- a/packages/core/src/tools/web-search.test.ts +++ b/packages/core/src/tools/web-search.test.ts @@ -8,6 +8,7 @@ import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; import { WebSearchTool, WebSearchToolParams } from './web-search.js'; import { Config } from '../config/config.js'; import { GeminiClient } from '../core/client.js'; +import { ToolErrorType } from './tool-error.js'; // Mock GeminiClient and Config constructor vi.mock('../core/client.js'); @@ -112,7 +113,7 @@ describe('WebSearchTool', () => { expect(result.returnDisplay).toBe('No information found.'); }); - it('should handle API errors gracefully', async () => { + it('should return a WEB_SEARCH_FAILED error on failure', async () => { const params: WebSearchToolParams = { query: 'error query' }; const testError = new Error('API Failure'); (mockGeminiClient.generateContent as Mock).mockRejectedValue(testError); @@ -120,6 +121,7 @@ describe('WebSearchTool', () => { const invocation = tool.build(params); const result = await invocation.execute(abortSignal); + expect(result.error?.type).toBe(ToolErrorType.WEB_SEARCH_FAILED); expect(result.llmContent).toContain('Error:'); expect(result.llmContent).toContain('API Failure'); expect(result.returnDisplay).toBe('Error performing web search.'); |
