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

Function TestStripAtPathPrefix

pkg/parser/schema_errors_test.go:242–277  ·  view source on GitHub ↗

TestStripAtPathPrefix tests removal of "at '/path':" prefixes from error lines

(t *testing.T)

Source from the content-addressed store, hash-verified

240
241// TestStripAtPathPrefix tests removal of "at '/path':" prefixes from error lines
242func 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
280func TestCleanJSONSchemaErrorMessage(t *testing.T) {

Callers

nothing calls this directly

Calls 2

stripAtPathPrefixFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected