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

Function TestExtractMetadataRealisticLockFile

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

Source from the content-addressed store, hash-verified

481}
482
483func TestExtractMetadataRealisticLockFile(t *testing.T) {
484 // Realistic lock file content with metadata
485 content := `# ___ _ _
486# / _ \ | | (_)
487# | |_| | __ _ ___ _ __ | |_ _ ___
488#
489# This file was automatically generated by gh-aw. DO NOT EDIT.
490#
491# Daily status report for gh-aw project
492#
493# Resolved workflow manifest:
494# Imports:
495# - shared/reporting.md
496#
497# gh-aw-metadata: {"schema_version":"v1","frontmatter_hash":"49266e50774d7e6a8b1c50f64b2f790c214dcdcf7b75b6bc8478bb43257b9863"}
498
499name: "Dev"
500on:
501 schedule:
502 - cron: "0 9 * * *"
503`
504
505 metadata, isLegacy, err := ExtractMetadataFromLockFile(content)
506 require.NoError(t, err, "Should parse realistic lock file")
507 assert.False(t, isLegacy, "Should not detect as legacy")
508 require.NotNil(t, metadata, "Should extract metadata")
509 assert.Equal(t, LockSchemaV1, metadata.SchemaVersion)
510 assert.Equal(t, "49266e50774d7e6a8b1c50f64b2f790c214dcdcf7b75b6bc8478bb43257b9863", metadata.FrontmatterHash)
511}
512
513func TestExtractMetadataLegacyLockFile(t *testing.T) {
514 // Legacy lock file without metadata

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected