TestConsoleFormatErrorMessageUsage verifies console.FormatErrorMessage is used correctly
(t *testing.T)
| 83 | |
| 84 | // TestConsoleFormatErrorMessageUsage verifies console.FormatErrorMessage is used correctly |
| 85 | func TestConsoleFormatErrorMessageUsage(t *testing.T) { |
| 86 | tests := []struct { |
| 87 | name string |
| 88 | message string |
| 89 | shouldContain []string |
| 90 | }{ |
| 91 | { |
| 92 | name: "simple error message", |
| 93 | message: "Something went wrong", |
| 94 | shouldContain: []string{ |
| 95 | "Something went wrong", |
| 96 | }, |
| 97 | }, |
| 98 | { |
| 99 | name: "error with details", |
| 100 | message: "Failed to compile workflow: invalid syntax", |
| 101 | shouldContain: []string{ |
| 102 | "Failed to compile workflow", |
| 103 | "invalid syntax", |
| 104 | }, |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | for _, tt := range tests { |
| 109 | t.Run(tt.name, func(t *testing.T) { |
| 110 | formatted := console.FormatErrorMessage(tt.message) |
| 111 | |
| 112 | // Verify the formatted message contains the original text |
| 113 | for _, expected := range tt.shouldContain { |
| 114 | assert.Contains(t, formatted, expected, |
| 115 | "Formatted message should contain: %s", expected) |
| 116 | } |
| 117 | }) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // TestConsoleFormatWarningMessageUsage verifies console.FormatWarningMessage is used correctly |
| 122 | func TestConsoleFormatWarningMessageUsage(t *testing.T) { |
nothing calls this directly
no test coverage detected