From 29039ed69da73e30232a90c75058ede86cf44275 Mon Sep 17 00:00:00 2001 From: gastown/crew/george Date: Fri, 16 Jan 2026 12:41:23 -0800 Subject: [PATCH] fix(migrate_agents_test): test actually calls getMigrationStatusIcon The test was duplicating the icon selection logic in a switch statement instead of calling the actual function being tested. Extract the icon logic into getMigrationStatusIcon() and have the test call it directly. Co-Authored-By: Claude Opus 4.5 --- internal/cmd/migrate_agents.go | 18 +++++++++++------- internal/cmd/migrate_agents_test.go | 12 ++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/internal/cmd/migrate_agents.go b/internal/cmd/migrate_agents.go index 6d926086..742326c8 100644 --- a/internal/cmd/migrate_agents.go +++ b/internal/cmd/migrate_agents.go @@ -284,17 +284,21 @@ func migrateRoleBead(sourceBd, targetBd *beads.Beads, oldID, newID, role string, return result } -func printMigrationResult(r migrationResult) { - var icon string - switch r.Status { +func getMigrationStatusIcon(status string) string { + switch status { case "migrated", "would migrate": - icon = " ✓" + return " ✓" case "skipped": - icon = " ⊘" + return " ⊘" case "error": - icon = " ✗" + return " ✗" + default: + return " ?" } - fmt.Printf("%s %s → %s: %s\n", icon, r.OldID, r.NewID, r.Message) +} + +func printMigrationResult(r migrationResult) { + fmt.Printf("%s %s → %s: %s\n", getMigrationStatusIcon(r.Status), r.OldID, r.NewID, r.Message) } func printMigrationSummary(results []migrationResult, dryRun bool) { diff --git a/internal/cmd/migrate_agents_test.go b/internal/cmd/migrate_agents_test.go index e60ee277..b5d1ea2f 100644 --- a/internal/cmd/migrate_agents_test.go +++ b/internal/cmd/migrate_agents_test.go @@ -56,17 +56,9 @@ func TestMigrationResultStatus(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var icon string - switch tt.result.Status { - case "migrated", "would migrate": - icon = " ✓" - case "skipped": - icon = " ⊘" - case "error": - icon = " ✗" - } + icon := getMigrationStatusIcon(tt.result.Status) if icon != tt.wantIcon { - t.Errorf("icon for status %q = %q, want %q", tt.result.Status, icon, tt.wantIcon) + t.Errorf("getMigrationStatusIcon(%q) = %q, want %q", tt.result.Status, icon, tt.wantIcon) } }) }