(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func 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 | } |
nothing calls this directly
no test coverage detected