From 5d1f237d28d810bcef4a49b02014f8cc23229480 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 24 Oct 2024 11:38:46 -0400 Subject: [PATCH] chore(help): simplify ansi stripping in test --- help/help_test.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/help/help_test.go b/help/help_test.go index 294b9e6..448a78b 100644 --- a/help/help_test.go +++ b/help/help_test.go @@ -2,11 +2,9 @@ package help import ( "fmt" - "os" - "strings" "testing" - "github.com/charmbracelet/colorprofile" + "github.com/charmbracelet/x/ansi" "github.com/charmbracelet/x/exp/golden" "github.com/charmbracelet/bubbles/v2/key" @@ -35,17 +33,8 @@ func TestFullHelp(t *testing.T) { t.Run(fmt.Sprintf("full help %d width", w), func(t *testing.T) { m.Width = w s := m.FullHelpView(kb) - - // Downsample color to NoTTY mode. - var b strings.Builder - downsampler := colorprofile.NewWriter(&b, os.Environ()) - downsampler.Profile = colorprofile.NoTTY - _, err := downsampler.WriteString(s) - if err != nil { - t.Error(err) - } - - golden.RequireEqual(t, []byte(b.String())) + s = ansi.Strip(s) + golden.RequireEqual(t, []byte(s)) }) } }