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

Function TestHashWithRealWorkflow

pkg/parser/frontmatter_hash_cross_language_test.go:132–156  ·  view source on GitHub ↗

TestHashWithRealWorkflow tests hash computation with an actual workflow from the repository

(t *testing.T)

Source from the content-addressed store, hash-verified

130
131// TestHashWithRealWorkflow tests hash computation with an actual workflow from the repository
132func TestHashWithRealWorkflow(t *testing.T) {
133 // Find a real workflow file
134 repoRoot := findRepoRoot(t)
135 workflowFile := filepath.Join(repoRoot, ".github", "workflows", "audit-workflows.md")
136
137 // Check if file exists
138 if _, err := os.Stat(workflowFile); os.IsNotExist(err) {
139 t.Skip("Real workflow file not found, skipping test")
140 return
141 }
142
143 cache := NewImportCache(repoRoot)
144
145 hash, err := ComputeFrontmatterHashFromFile(workflowFile, cache)
146 require.NoError(t, err, "Should compute hash for real workflow")
147 assert.Len(t, hash, 64, "Hash should be 64 characters")
148 assert.Regexp(t, "^[a-f0-9]{64}$", hash, "Hash should be lowercase hex")
149
150 t.Logf("Hash for audit-workflows.md: %s", hash)
151
152 // Verify determinism
153 hash2, err := ComputeFrontmatterHashFromFile(workflowFile, cache)
154 require.NoError(t, err, "Should compute hash again")
155 assert.Equal(t, hash, hash2, "Hash should be deterministic")
156}
157
158// TestHashWithTemplateExpressions tests hash computation including template expressions
159func TestHashWithTemplateExpressions(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewImportCacheFunction · 0.85
findRepoRootFunction · 0.70

Tested by

no test coverage detected