Files
docker-agent/pkg/runtime/agent_tools_test.go
T
Arnaud Héritier 95374887c2 feat(tui): add right-click Agent Inspector with live + configured details
Add a read-only agent-details modal opened by right-click (or Ctrl+click);
plain left-click switches agent. The inspector shows the agent's
configuration (model, fallback, thinking, sub-agents, handoffs, skills,
limits, options, toolsets with their declared tools, commands) and live
state (current-agent marker and per-toolset started/stopped/error status
with live tool names when started). Retains the raw per-agent config on the
team and adds per-agent toolset-status and config accessors to source it.
2026-06-18 10:48:59 +02:00

28 lines
1022 B
Go

package runtime
import (
"testing"
"github.com/stretchr/testify/assert"
)
// TestUniqueNames verifies the helper backing AgentConfigInfo: it drops empty
// names and de-duplicates, preserving first-seen order by default (so
// declaration/priority order survives) and sorting case-insensitively when
// requested, keeping the agent-details config lines stable and readable.
func TestUniqueNames(t *testing.T) {
t.Parallel()
// Default: first-seen order preserved, empties dropped, duplicates removed.
got := uniqueNames([]string{"shell", "", "filesystem", "shell", "git"}, false)
assert.Equal(t, []string{"shell", "filesystem", "git"}, got)
// Sorted: case-insensitive ordering after de-duping. A lowercase name sorts
// before an uppercase one alphabetically, unlike a raw byte comparison.
sorted := uniqueNames([]string{"Zebra", "apple", "apple"}, true)
assert.Equal(t, []string{"apple", "Zebra"}, sorted)
assert.Empty(t, uniqueNames(nil, false))
assert.Empty(t, uniqueNames([]string{"", ""}, true))
}