cli/pkg/cli/check_test.go
Virgil 81be3b701e fix(cli): theme-aware semantic glyphs
Keep section headers, check skips, and layout separators aligned with the active glyph theme.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 12:31:44 +00:00

69 lines
1.2 KiB
Go

package cli
import (
"strings"
"testing"
)
func TestCheckBuilder(t *testing.T) {
restoreThemeAndColors(t)
UseASCII() // Deterministic output
// Pass
c := Check("foo").Pass()
got := c.String()
if got == "" {
t.Error("Empty output for Pass")
}
// Fail
c = Check("foo").Fail()
got = c.String()
if got == "" {
t.Error("Empty output for Fail")
}
// Skip
c = Check("foo").Skip()
got = c.String()
if got == "" {
t.Error("Empty output for Skip")
}
if !strings.Contains(got, "[SKIP]") {
t.Error("Expected ASCII skip icon")
}
// Warn
c = Check("foo").Warn()
got = c.String()
if got == "" {
t.Error("Empty output for Warn")
}
// Duration
c = Check("foo").Pass().Duration("1s")
got = c.String()
if got == "" {
t.Error("Empty output for Duration")
}
// Message
c = Check("foo").Message("status")
got = c.String()
if got == "" {
t.Error("Empty output for Message")
}
// Glyph shortcodes
c = Check(":check: foo").Warn().Message(":warn:")
got = c.String()
if got == "" {
t.Error("Empty output for glyph shortcode rendering")
}
if !strings.Contains(got, "[OK] foo") {
t.Error("Expected shortcode-rendered name")
}
if strings.Count(got, "[WARN]") < 2 {
t.Error("Expected shortcode-rendered warning icon and message")
}
}