package tui import ( "strings" "testing" "git.a-wan.net/alan/pipelines/internal/protocol" ) func TestArtifactsDeliverablesLeadAndDebugFilesAreMarked(t *testing.T) { artifacts := []protocol.StageArtifact{ {Name: "input.md", ContentType: "text/markdown", Group: protocol.ArtifactGroupDebug}, {Name: "history.md", ContentType: "text/markdown", Group: protocol.ArtifactGroupDebug}, {Name: "public/report.png", ContentType: "image/png", Group: protocol.ArtifactGroupDeliverable}, } ordered := deliverablesFirst(artifacts) if ordered[0].Name != "public/report.png" || ordered[1].Name != "input.md" || ordered[2].Name != "history.md" { t.Fatalf("order = %+v", ordered) } widths := artifactWidthsFor([]artifactVisit{{artifacts: ordered}}) if row := artifactRowText(ordered[1], widths, 100, false); !strings.Contains(row, "[dbg] input.md") { t.Fatalf("debug row not marked: %q", row) } if row := artifactRowText(ordered[0], widths, 100, false); !strings.Contains(row, "[img] public/report.png") { t.Fatalf("deliverable row: %q", row) } }