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

Function TestConfigurationError

pkg/workflow/error_helpers_test.go:95–122  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestConfigurationError(t *testing.T) {
96 t.Run("basic configuration error", func(t *testing.T) {
97 err := NewConfigurationError("safe-outputs.max", "abc", "must be an integer", "Use a numeric value")
98
99 require.Error(t, err)
100 assert.Contains(t, err.Error(), "Configuration error in 'safe-outputs.max'")
101 assert.Contains(t, err.Error(), "Value: abc")
102 assert.Contains(t, err.Error(), "Reason: must be an integer")
103 assert.Contains(t, err.Error(), "Suggestion: Use a numeric value")
104 })
105
106 t.Run("configuration error with default suggestion", func(t *testing.T) {
107 err := NewConfigurationError("safe-outputs.target", "invalid", "not a valid target", "")
108
109 require.Error(t, err)
110 assert.Contains(t, err.Error(), "Configuration error")
111 assert.Contains(t, err.Error(), "Check the safe-outputs configuration")
112 })
113
114 t.Run("configuration error with long value", func(t *testing.T) {
115 longValue := strings.Repeat("x", 200)
116 err := NewConfigurationError("config.field", longValue, "invalid", "")
117
118 require.Error(t, err)
119 // Value should be truncated
120 assert.Contains(t, err.Error(), "...")
121 })
122}

Callers

nothing calls this directly

Calls 4

ErrorMethod · 0.95
NewConfigurationErrorFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected