| package tools |
| |
| import ( |
| "testing" |
| |
| "github.com/korap/korap-mcp/service" |
| "github.com/stretchr/testify/assert" |
| ) |
| |
| func TestSearchTool_Name(t *testing.T) { |
| client := &service.Client{} |
| tool := NewSearchTool(client) |
| |
| assert.Equal(t, "korap_search", tool.Name()) |
| } |
| |
| func TestSearchTool_Description(t *testing.T) { |
| client := &service.Client{} |
| tool := NewSearchTool(client) |
| |
| expected := "Search for words or phrases in KorAP corpora using various query languages" |
| assert.Equal(t, expected, tool.Description()) |
| } |
| |
| func TestSearchTool_InputSchema(t *testing.T) { |
| client := &service.Client{} |
| tool := NewSearchTool(client) |
| |
| schema := tool.InputSchema() |
| |
| // Verify it's an object type |
| assert.Equal(t, "object", schema["type"]) |
| |
| // Verify properties exist |
| properties, ok := schema["properties"].(map[string]interface{}) |
| assert.True(t, ok) |
| assert.Contains(t, properties, "query") |
| assert.Contains(t, properties, "query_language") |
| assert.Contains(t, properties, "corpus") |
| assert.Contains(t, properties, "count") |
| // Note: offset and context will be added in future iterations |
| |
| // Verify required fields |
| required, ok := schema["required"].([]string) |
| assert.True(t, ok) |
| assert.Contains(t, required, "query") |
| } |
| |
| func TestNewSearchTool(t *testing.T) { |
| client := &service.Client{} |
| tool := NewSearchTool(client) |
| |
| assert.NotNil(t, tool) |
| assert.Equal(t, client, tool.client) |
| } |
| |
| // TestSearchTool_Execute will be implemented once the Execute method is fixed |
| func TestSearchTool_Execute_WillBeImplemented(t *testing.T) { |
| t.Skip("Execute method needs to be fixed first") |
| |
| // This test will be implemented once we fix the linter errors |
| // in the Execute method |
| } |