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

Function TestConsoleFormatErrorMessageUsage

pkg/cli/error_formatting_test.go:85–119  ·  view source on GitHub ↗

TestConsoleFormatErrorMessageUsage verifies console.FormatErrorMessage is used correctly

(t *testing.T)

Source from the content-addressed store, hash-verified

83
84// TestConsoleFormatErrorMessageUsage verifies console.FormatErrorMessage is used correctly
85func 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
122func TestConsoleFormatWarningMessageUsage(t *testing.T) {

Callers

nothing calls this directly

Calls 2

FormatErrorMessageFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected