MCPcopy
hub / github.com/cli/cli / TestNewServiceLogModeWithColorLogsToWriter

Function TestNewServiceLogModeWithColorLogsToWriter

internal/telemetry/telemetry_test.go:339–352  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

337}
338
339func TestNewServiceLogModeWithColorLogsToWriter(t *testing.T) {
340 t.Cleanup(stubDeviceID("test-device"))
341
342 var buf bytes.Buffer
343 svc := NewService(LogFlusher(&buf, true))
344
345 svc.Record(ghtelemetry.Event{Type: "color_event"})
346 svc.Flush()
347
348 output := buf.String()
349 assert.Contains(t, output, "color_event")
350 // Verify ANSI color codes are present in the output
351 assert.Contains(t, output, "\033[", "expected ANSI escape sequences when color is enabled")
352}
353
354func TestLogFlusherWritesNoneMarkerForEmptyPayload(t *testing.T) {
355 t.Run("no color", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

FlushMethod · 0.95
stubDeviceIDFunction · 0.85
NewServiceFunction · 0.85
ContainsMethod · 0.80
RecordMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected