From 7fad9c7071a1aef53f2d0f49fa44ee98326ae391 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 25 Feb 2026 10:37:35 +0000 Subject: [PATCH] test(web): add unit test for WebSearchTool.Description date injection --- pkg/tools/web_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/tools/web_test.go b/pkg/tools/web_test.go index 75e0d8d16..359d2f759 100644 --- a/pkg/tools/web_test.go +++ b/pkg/tools/web_test.go @@ -405,3 +405,18 @@ func TestWebTool_TavilySearch_Success(t *testing.T) { t.Errorf("Expected 'via Tavily' in output, got: %s", result.ForUser) } } + +// TestWebTool_WebSearch_Description verifies that the Description method contains the current date format +func TestWebTool_WebSearch_Description(t *testing.T) { + tool := NewWebSearchTool(WebSearchToolOptions{DuckDuckGoEnabled: true}) + desc := tool.Description() + + if !strings.Contains(desc, "Today's date is") { + t.Errorf("Expected Description to contain 'Today's date is', got: %s", desc) + } + + // Should at least contain a 20XX year (simple verification it is injecting the date) + if !strings.Contains(desc, "202") { + t.Errorf("Expected Description to contain '202X' year, got: %s", desc) + } +}