TestStripAtPathPrefix tests removal of "at '/path':" prefixes from error lines
(t *testing.T)
| 240 | |
| 241 | // TestStripAtPathPrefix tests removal of "at '/path':" prefixes from error lines |
| 242 | func TestStripAtPathPrefix(t *testing.T) { |
| 243 | tests := []struct { |
| 244 | name string |
| 245 | line string |
| 246 | want string |
| 247 | }{ |
| 248 | { |
| 249 | name: "top-level path stripped entirely", |
| 250 | line: "- at '/engine': value must be one of 'claude', 'codex'", |
| 251 | want: "value must be one of 'claude', 'codex'", |
| 252 | }, |
| 253 | { |
| 254 | name: "nested path keeps last component", |
| 255 | line: "- at '/permissions/deployments': value must be one of 'read', 'write', 'none'", |
| 256 | want: "'deployments': value must be one of 'read', 'write', 'none'", |
| 257 | }, |
| 258 | { |
| 259 | name: "line without at-path prefix is unchanged", |
| 260 | line: "value must be one of 'a', 'b'", |
| 261 | want: "value must be one of 'a', 'b'", |
| 262 | }, |
| 263 | { |
| 264 | name: "at-path without dash prefix", |
| 265 | line: "at '/engine': some error", |
| 266 | want: "some error", |
| 267 | }, |
| 268 | } |
| 269 | |
| 270 | for _, tt := range tests { |
| 271 | t.Run(tt.name, func(t *testing.T) { |
| 272 | got := stripAtPathPrefix(tt.line) |
| 273 | assert.Equal(t, tt.want, got, |
| 274 | "stripAtPathPrefix(%q) = %q, want %q", tt.line, got, tt.want) |
| 275 | }) |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | // TestCleanJSONSchemaErrorMessage tests the full cleanup pipeline for jsonschema errors |
| 280 | func TestCleanJSONSchemaErrorMessage(t *testing.T) { |
nothing calls this directly
no test coverage detected