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

Function TestValidationErrorMessages

pkg/workflow/lock_schema_test.go:436–481  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

434}
435
436func TestValidationErrorMessages(t *testing.T) {
437 tests := []struct {
438 name string
439 content string
440 lockPath string
441 expectedMessages []string
442 }{
443 {
444 name: "future version error has remediation",
445 content: `# gh-aw-metadata: {"schema_version":"v99"}
446name: test
447`,
448 lockPath: "future.lock.yml",
449 expectedMessages: []string{
450 "unsupported schema version 'v99'",
451 "Upgrade gh-aw",
452 "gh extension upgrade gh-aw",
453 "gh aw compile future.md",
454 },
455 },
456 {
457 name: "missing metadata error has remediation",
458 content: `name: test
459on: push
460`,
461 lockPath: "missing.lock.yml",
462 expectedMessages: []string{
463 "missing required metadata",
464 "recompile the workflow",
465 "gh aw compile missing.md",
466 },
467 },
468 }
469
470 for _, tt := range tests {
471 t.Run(tt.name, func(t *testing.T) {
472 err := ValidateLockSchemaCompatibility(tt.content, tt.lockPath)
473 require.Error(t, err, "Should have validation error")
474
475 errMsg := err.Error()
476 for _, expected := range tt.expectedMessages {
477 assert.Contains(t, errMsg, expected, "Error message should contain remediation guidance")
478 }
479 })
480 }
481}
482
483func TestExtractMetadataRealisticLockFile(t *testing.T) {
484 // Realistic lock file content with metadata

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected