diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-08 19:15:23 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-08 19:15:23 +0200 |
| commit | 94923948e1a1525988bf13025a10cc9226652684 (patch) | |
| tree | 91d6b5b78b6af47a7272e92b54386eee42f21e50 /internal/llm/tools/sourcegraph_test.go | |
| parent | 5acf0cba6040aaf90acb5dcacd3e4127d6833ac5 (diff) | |
| download | opencode-94923948e1a1525988bf13025a10cc9226652684.tar.gz opencode-94923948e1a1525988bf13025a10cc9226652684.zip | |
structure tools the same
- add some tests
- fix some tests
- change how we handle permissions
Diffstat (limited to 'internal/llm/tools/sourcegraph_test.go')
| -rw-r--r-- | internal/llm/tools/sourcegraph_test.go | 29 |
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 { |
