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

Function TestExtractYAMLValueAtPath

pkg/parser/schema_suggestions_test.go:353–455  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

351}
352
353func TestExtractYAMLValueAtPath(t *testing.T) {
354 tests := []struct {
355 name string
356 yaml string
357 path string
358 wantValue string
359 }{
360 {
361 name: "simple top-level field",
362 yaml: "engine: coplit\ntimeout-minutes: 30\n",
363 path: "/engine",
364 wantValue: "coplit",
365 },
366 {
367 name: "field with double-quoted value",
368 yaml: `engine: "copilot"` + "\n",
369 path: "/engine",
370 wantValue: "copilot",
371 },
372 {
373 name: "field with single-quoted value",
374 yaml: "engine: 'copilot'\n",
375 path: "/engine",
376 wantValue: "copilot",
377 },
378 {
379 name: "nested path - child not in yaml returns empty",
380 yaml: "engine: copilot\n",
381 path: "/permissions/issues",
382 wantValue: "",
383 },
384 {
385 name: "nested path - extracts value under parent key",
386 yaml: "permissions:\n contents: raed\n issues: write\n",
387 path: "/permissions/contents",
388 wantValue: "raed",
389 },
390 {
391 name: "nested path - second child key",
392 yaml: "permissions:\n contents: read\n issues: neno\n",
393 path: "/permissions/issues",
394 wantValue: "neno",
395 },
396 {
397 name: "nested path - single-quoted value",
398 yaml: "permissions:\n contents: 'raed'\n",
399 path: "/permissions/contents",
400 wantValue: "raed",
401 },
402 {
403 name: "nested path - double-quoted value",
404 yaml: "permissions:\n contents: \"raed\"\n",
405 path: "/permissions/contents",
406 wantValue: "raed",
407 },
408 {
409 name: "three-level path returns empty",
410 yaml: "a:\n b:\n c: value\n",

Callers

nothing calls this directly

Calls 2

extractYAMLValueAtPathFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected