yinwm
0ac93d4429
feat: US-014 - Add WebTool tests
Added comprehensive test coverage for WebTool (WebSearchTool, WebFetchTool) with 9 test cases:
- TestWebTool_WebFetch_Success: Verifies successful URL fetching
- TestWebTool_WebFetch_JSON: Verifies JSON content handling
- TestWebTool_WebFetch_InvalidURL: Verifies error handling for invalid URLs
- TestWebTool_WebFetch_UnsupportedScheme: Verifies only http/https allowed
- TestWebTool_WebFetch_MissingURL: Verifies missing URL parameter handling
- TestWebTool_WebFetch_Truncation: Verifies content truncation at maxChars
- TestWebTool_WebSearch_NoApiKey: Verifies API key requirement
- TestWebTool_WebSearch_MissingQuery: Verifies missing query parameter
- TestWebTool_WebFetch_HTMLExtraction: Verifies HTML tag removal and text extraction
- TestWebTool_WebFetch_MissingDomain: Verifies domain validation
WebTool implementation already conforms to ToolResult specification:
- WebFetch returns ForUser=fetched content, ForLLM=summary with byte count
- WebSearch returns ForUser=search results, ForLLM=result count
- Errors return ErrorResult with IsError=true
Tests use httptest.NewServer for mock HTTP servers, avoiding external API dependencies.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:54:44 +08:00
..
2026-02-12 19:49:36 +08:00
2026-02-11 11:41:13 -06:00
2026-02-09 19:20:19 +08:00
2026-02-12 12:46:28 +08:00
2026-02-12 11:59:05 +08:00
2026-02-11 20:31:41 +08:00
2026-02-12 19:39:57 +08:00
2026-02-09 19:20:19 +08:00
2026-02-11 12:48:16 -06:00
2026-02-11 13:39:19 -06:00
2026-02-11 20:31:41 +08:00
2026-02-11 00:14:33 +08:00
2026-02-12 19:46:10 +08:00
2026-02-12 19:54:44 +08:00
2026-02-12 12:46:28 +08:00
2026-02-12 00:46:48 +08:00