TestHashWithRealWorkflow tests hash computation with an actual workflow from the repository
(t *testing.T)
| 130 | |
| 131 | // TestHashWithRealWorkflow tests hash computation with an actual workflow from the repository |
| 132 | func 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 |
| 159 | func TestHashWithTemplateExpressions(t *testing.T) { |
nothing calls this directly
no test coverage detected