blob: abd6bef96a21e989632220354f9a88fc4ab8326a [file] [log] [blame]
Akronb1c71e62025-06-12 16:08:54 +02001package tools
2
3import (
4 "testing"
5
6 "github.com/korap/korap-mcp/service"
7 "github.com/stretchr/testify/assert"
8)
9
10func TestSearchTool_Name(t *testing.T) {
11 client := &service.Client{}
12 tool := NewSearchTool(client)
13
14 assert.Equal(t, "korap_search", tool.Name())
15}
16
17func TestSearchTool_Description(t *testing.T) {
18 client := &service.Client{}
19 tool := NewSearchTool(client)
20
21 expected := "Search for words or phrases in KorAP corpora using various query languages"
22 assert.Equal(t, expected, tool.Description())
23}
24
25func TestSearchTool_InputSchema(t *testing.T) {
26 client := &service.Client{}
27 tool := NewSearchTool(client)
28
29 schema := tool.InputSchema()
30
31 // Verify it's an object type
32 assert.Equal(t, "object", schema["type"])
33
34 // Verify properties exist
35 properties, ok := schema["properties"].(map[string]interface{})
36 assert.True(t, ok)
37 assert.Contains(t, properties, "query")
38 assert.Contains(t, properties, "query_language")
39 assert.Contains(t, properties, "corpus")
40 assert.Contains(t, properties, "count")
41 // Note: offset and context will be added in future iterations
42
43 // Verify required fields
44 required, ok := schema["required"].([]string)
45 assert.True(t, ok)
46 assert.Contains(t, required, "query")
47}
48
49func TestNewSearchTool(t *testing.T) {
50 client := &service.Client{}
51 tool := NewSearchTool(client)
52
53 assert.NotNil(t, tool)
54 assert.Equal(t, client, tool.client)
55}
56
57// TestSearchTool_Execute will be implemented once the Execute method is fixed
58func TestSearchTool_Execute_WillBeImplemented(t *testing.T) {
59 t.Skip("Execute method needs to be fixed first")
60
61 // This test will be implemented once we fix the linter errors
62 // in the Execute method
63}