Files
docker-agent/pkg/tools/catalog_test.go
T
David Gageot a3ce461e9b feat(openai): add cache diagnostics, preserve_reasoning, and native_tool_search provider opts
Surface prompt cache diagnostics from Responses API results, let agents
opt into carrying reasoning state across turns, and use OpenAI's hosted
tool search for deferred tools instead of the local catalog lookup.

Assisted-By: cagent
2026-09-17 21:22:40 +02:00

26 lines
763 B
Go

package tools
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestWithoutSearchOnly(t *testing.T) {
t.Parallel()
regular := []Tool{{Name: "read"}, {Name: "write"}}
assert.Equal(t, regular, WithoutSearchOnly(regular))
assert.Nil(t, WithoutSearchOnly(nil))
mixed := []Tool{{Name: "read"}, {Name: "search", InCatalog: true, SearchOnly: true}, {Name: "write"}}
filtered := WithoutSearchOnly(mixed)
assert.Equal(t, regular, filtered)
assert.Len(t, mixed, 3, "input must not be mutated")
// A listed catalog tool (e.g. activated through add_tool) is a regular
// tool for providers without hosted tool search.
listed := []Tool{{Name: "read"}, {Name: "activated", InCatalog: true}}
assert.Equal(t, listed, WithoutSearchOnly(listed))
}