(t *testing.T)
| 464 | } |
| 465 | |
| 466 | func 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 | |
| 511 | func TestRenderInfoSection(t *testing.T) { |
| 512 | tests := []struct { |
nothing calls this directly
no test coverage detected