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 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/george
2026-01-16 12:41:23 -08:00
committed by Steve Yegge
parent b1a5241430
commit 29039ed69d
2 changed files with 13 additions and 17 deletions

View File

@@ -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) {

View File

@@ -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)
}
})
}