Fixed legacy web search test files

This commit is contained in:
Hua 2026-02-13 22:14:54 +01:00
parent d43068fbf0
commit 9b88714be0
2 changed files with 16 additions and 6 deletions

View file

@ -136,11 +136,15 @@ func TestDefaultConfig_WebTools(t *testing.T) {
cfg := DefaultConfig() cfg := DefaultConfig()
// Verify web tools defaults // Verify web tools defaults
if cfg.Tools.Web.Search.MaxResults != 5 { if cfg.Tools.Web.Brave.MaxResults != 5 {
t.Error("Expected MaxResults 5, got ", cfg.Tools.Web.Search.MaxResults) t.Error("Expected Brave MaxResults 5, got ", cfg.Tools.Web.Brave.MaxResults)
} }
if cfg.Tools.Web.Search.APIKey != "" { if cfg.Tools.Web.Brave.APIKey != "" {
t.Error("Search API key should be empty by default") t.Error("Brave API key should be empty by default")
}
if cfg.Tools.Web.DuckDuckGo.MaxResults != 5 {
t.Error("Expected DuckDuckGo MaxResults 5, got ", cfg.Tools.Web.DuckDuckGo.MaxResults)
} }
} }

View file

@ -175,7 +175,10 @@ func TestWebTool_WebFetch_Truncation(t *testing.T) {
// TestWebTool_WebSearch_NoApiKey verifies error handling when API key is missing // TestWebTool_WebSearch_NoApiKey verifies error handling when API key is missing
func TestWebTool_WebSearch_NoApiKey(t *testing.T) { func TestWebTool_WebSearch_NoApiKey(t *testing.T) {
tool := NewWebSearchTool("", 5) tool := NewWebSearchTool(WebSearchToolOptions{
BraveAPIKey: "", // no api key test
BraveMaxResults: 5,
})
ctx := context.Background() ctx := context.Background()
args := map[string]interface{}{ args := map[string]interface{}{
"query": "test", "query": "test",
@ -196,7 +199,10 @@ func TestWebTool_WebSearch_NoApiKey(t *testing.T) {
// TestWebTool_WebSearch_MissingQuery verifies error handling for missing query // TestWebTool_WebSearch_MissingQuery verifies error handling for missing query
func TestWebTool_WebSearch_MissingQuery(t *testing.T) { func TestWebTool_WebSearch_MissingQuery(t *testing.T) {
tool := NewWebSearchTool("test-key", 5) tool := NewWebSearchTool(WebSearchToolOptions{
BraveAPIKey: "test-key", // no api key test
BraveMaxResults: 5,
})
ctx := context.Background() ctx := context.Background()
args := map[string]interface{}{} args := map[string]interface{}{}