summaryrefslogtreecommitdiffhomepage
path: root/internal/llm/tools/sourcegraph_test.go
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-08 19:42:59 +0200
committerGitHub <[email protected]>2025-04-08 19:42:59 +0200
commit124bd57c507fdcbb56ab27137cbe892f12e1b48f (patch)
tree894d335a5f2f6587a19e94f139f681b91b01e877 /internal/llm/tools/sourcegraph_test.go
parent5acf0cba6040aaf90acb5dcacd3e4127d6833ac5 (diff)
parentc571283ac26cdf03be5a1d5c1e36051e3b7ea7be (diff)
downloadopencode-124bd57c507fdcbb56ab27137cbe892f12e1b48f.tar.gz
opencode-124bd57c507fdcbb56ab27137cbe892f12e1b48f.zip
Merge pull request #24 from kujtimiihoxha/cleanup-tools
Cleanup tools
Diffstat (limited to 'internal/llm/tools/sourcegraph_test.go')
-rw-r--r--internal/llm/tools/sourcegraph_test.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/internal/llm/tools/sourcegraph_test.go b/internal/llm/tools/sourcegraph_test.go
index 5657ccd7e..89829aefc 100644
--- a/internal/llm/tools/sourcegraph_test.go
+++ b/internal/llm/tools/sourcegraph_test.go
@@ -5,7 +5,6 @@ import (
"encoding/json"
"testing"
- "github.com/kujtimiihoxha/termai/internal/permission"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -23,13 +22,6 @@ func TestSourcegraphTool_Info(t *testing.T) {
}
func TestSourcegraphTool_Run(t *testing.T) {
- // Setup a mock permission handler that always allows
- origPermission := permission.Default
- defer func() {
- permission.Default = origPermission
- }()
- permission.Default = newMockPermissionService(true)
-
t.Run("handles missing query parameter", func(t *testing.T) {
tool := NewSourcegraphTool()
params := SourcegraphParams{
@@ -61,27 +53,6 @@ func TestSourcegraphTool_Run(t *testing.T) {
assert.Contains(t, response.Content, "Failed to parse sourcegraph parameters")
})
- t.Run("handles permission denied", func(t *testing.T) {
- permission.Default = newMockPermissionService(false)
-
- tool := NewSourcegraphTool()
- params := SourcegraphParams{
- Query: "test query",
- }
-
- paramsJSON, err := json.Marshal(params)
- require.NoError(t, err)
-
- call := ToolCall{
- Name: SourcegraphToolName,
- Input: string(paramsJSON),
- }
-
- response, err := tool.Run(context.Background(), call)
- require.NoError(t, err)
- assert.Contains(t, response.Content, "Permission denied")
- })
-
t.Run("normalizes count parameter", func(t *testing.T) {
// Test cases for count normalization
testCases := []struct {