mirror of
https://github.com/theniceboy/.config.git
synced 2026-05-02 11:33:40 +08:00
35 lines
946 B
Go
35 lines
946 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestDetectPaletteAgentIDFromPath(t *testing.T) {
|
|
got := detectPaletteAgentIDFromPath("/Users/david/Github/instaboard/.agents/icon-pad/repo")
|
|
if got != "icon-pad" {
|
|
t.Fatalf("expected icon-pad, got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestPaletteBuildActionsIncludesDestroyWhenAgentIDKnownWithoutRecord(t *testing.T) {
|
|
r := &paletteRuntime{
|
|
agentID: "icon-pad",
|
|
mainRepoRoot: "/tmp/repo",
|
|
currentPath: "/tmp/repo/.agents/icon-pad/repo",
|
|
}
|
|
actions := r.buildActions()
|
|
for _, action := range actions {
|
|
if action.Kind == paletteActionConfirmDestroy {
|
|
return
|
|
}
|
|
}
|
|
t.Fatalf("destroy action missing: %#v", actions)
|
|
}
|
|
|
|
func TestPaletteEffectiveAgentIDIgnoresLiteralAndUsesPath(t *testing.T) {
|
|
r := &paletteRuntime{
|
|
agentID: "#{q:@agent_id}",
|
|
currentPath: "/tmp/repo/.agents/icon-pad/repo",
|
|
}
|
|
if got := r.effectiveAgentID(); got != "icon-pad" {
|
|
t.Fatalf("expected icon-pad, got %q", got)
|
|
}
|
|
}
|