MCPcopy Create free account
hub / github.com/github/gh-aw / TestFormatHelpersWithTTYCheck

Function TestFormatHelpersWithTTYCheck

pkg/console/console_test.go:192–218  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestFormatHelpersWithTTYCheck(t *testing.T) {
193 t.Run("plain output when tty check is false", func(t *testing.T) {
194 if got := formatInfoMessageWithTTY("processing file", func() bool { return false }); got != "i processing file" {
195 t.Fatalf("expected unstyled info message, got %q", got)
196 }
197 if got := formatSuccessMessageWithTTY("done", func() bool { return false }); got != "✓ done" {
198 t.Fatalf("expected unstyled success message, got %q", got)
199 }
200 if got := formatListItemWithTTY("item", func() bool { return false }); got != " • item" {
201 t.Fatalf("expected unstyled list item, got %q", got)
202 }
203 if got := formatSectionHeaderWithTTY("Header", func() bool { return false }); got != "Header" {
204 t.Fatalf("expected unstyled header, got %q", got)
205 }
206 })
207
208 t.Run("tty check is consulted", func(t *testing.T) {
209 calls := 0
210 _ = formatInfoMessageWithTTY("x", func() bool {
211 calls++
212 return false
213 })
214 if calls != 1 {
215 t.Fatalf("expected tty check to be called once, got %d", calls)
216 }
217 })
218}
219
220func TestRenderTable(t *testing.T) {
221 tests := []struct {

Callers

nothing calls this directly

Calls 5

formatInfoMessageWithTTYFunction · 0.85
formatListItemWithTTYFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected