(t *testing.T)
| 434 | } |
| 435 | |
| 436 | func 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"} |
| 446 | name: 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 |
| 459 | on: 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 | |
| 483 | func TestExtractMetadataRealisticLockFile(t *testing.T) { |
| 484 | // Realistic lock file content with metadata |
nothing calls this directly
no test coverage detected