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

Function TestRenderErrorBox

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

Source from the content-addressed store, hash-verified

464}
465
466func TestRenderErrorBox(t *testing.T) {
467 tests := []struct {
468 name string
469 title string
470 expected []string // Substrings that should be present in output
471 }{
472 {
473 name: "security advisory",
474 title: "🔴 SECURITY ADVISORIES",
475 expected: []string{
476 "🔴",
477 "SECURITY ADVISORIES",
478 },
479 },
480 {
481 name: "critical error",
482 title: "Critical Error",
483 expected: []string{
484 "Critical Error",
485 },
486 },
487 }
488
489 for _, tt := range tests {
490 t.Run(tt.name, func(t *testing.T) {
491 output := RenderErrorBox(tt.title)
492
493 // Check that output is not empty
494 if len(output) == 0 {
495 t.Error("RenderErrorBox() returned empty slice")
496 }
497
498 // Join output for checking
499 fullOutput := strings.Join(output, "\n")
500
501 // Check that title appears in output
502 for _, expected := range tt.expected {
503 if !strings.Contains(fullOutput, expected) {
504 t.Errorf("RenderErrorBox() output missing expected string '%s'\nGot:\n%s", expected, fullOutput)
505 }
506 }
507 })
508 }
509}
510
511func TestRenderInfoSection(t *testing.T) {
512 tests := []struct {

Callers

nothing calls this directly

Calls 4

RenderErrorBoxFunction · 0.70
RunMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected