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.
(t *testing.T)
| 11 | // declaration/priority order survives) and sorting case-insensitively when |
| 12 | // requested, keeping the agent-details config lines stable and readable. |
| 13 | func TestUniqueNames(t *testing.T) { |
| 14 | t.Parallel() |
| 15 | |
| 16 | // Default: first-seen order preserved, empties dropped, duplicates removed. |
| 17 | got := uniqueNames([]string{"shell", "", "filesystem", "shell", "git"}, false) |
| 18 | assert.Equal(t, []string{"shell", "filesystem", "git"}, got) |
| 19 | |
| 20 | // Sorted: case-insensitive ordering after de-duping. A lowercase name sorts |
| 21 | // before an uppercase one alphabetically, unlike a raw byte comparison. |
| 22 | sorted := uniqueNames([]string{"Zebra", "apple", "apple"}, true) |
| 23 | assert.Equal(t, []string{"apple", "Zebra"}, sorted) |
| 24 | |
| 25 | assert.Empty(t, uniqueNames(nil, false)) |
| 26 | assert.Empty(t, uniqueNames([]string{"", ""}, true)) |
| 27 | } |
nothing calls this directly
no test coverage detected