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

Function TestExtractMetadataLegacyLockFile

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

Source from the content-addressed store, hash-verified

511}
512
513func TestExtractMetadataLegacyLockFile(t *testing.T) {
514 // Legacy lock file without metadata
515 content := `#
516# This file was automatically generated by gh-aw. DO NOT EDIT.
517#
518# frontmatter-hash: 49266e50774d7e6a8b1c50f64b2f790c214dcdcf7b75b6bc8478bb43257b9863
519
520name: "Legacy"
521on: push
522`
523
524 metadata, isLegacy, err := ExtractMetadataFromLockFile(content)
525 require.NoError(t, err, "Should parse legacy lock file")
526 assert.True(t, isLegacy, "Should detect as legacy")
527 require.NotNil(t, metadata, "Should extract metadata with hash from legacy")
528 assert.Equal(t, "49266e50774d7e6a8b1c50f64b2f790c214dcdcf7b75b6bc8478bb43257b9863", metadata.FrontmatterHash, "Should extract hash from legacy")
529
530 // Legacy format should validate successfully
531 err = ValidateLockSchemaCompatibility(content, "legacy.lock.yml")
532 assert.NoError(t, err, "Legacy lock files should be accepted")
533}
534
535func TestMetadataPreservesHash(t *testing.T) {
536 // Test that frontmatter hash is preserved in metadata

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected