TestComputePolicyHash_NoPolicy verifies that workflows without a guard policy use the "nopolicy" sentinel hash.
(t *testing.T)
| 13 | // TestComputePolicyHash_NoPolicy verifies that workflows without a guard policy |
| 14 | // use the "nopolicy" sentinel hash. |
| 15 | func TestComputePolicyHash_NoPolicy(t *testing.T) { |
| 16 | tests := []struct { |
| 17 | name string |
| 18 | githubConfig *GitHubToolConfig |
| 19 | }{ |
| 20 | {name: "nil config", githubConfig: nil}, |
| 21 | {name: "empty config", githubConfig: &GitHubToolConfig{}}, |
| 22 | {name: "config without min-integrity", githubConfig: &GitHubToolConfig{AllowedRepos: "all"}}, |
| 23 | } |
| 24 | |
| 25 | for _, tt := range tests { |
| 26 | t.Run(tt.name, func(t *testing.T) { |
| 27 | hash := computePolicyHash(tt.githubConfig) |
| 28 | assert.Equal(t, noPolicySentinel, hash, "Should return nopolicy sentinel when no guard policy is configured") |
| 29 | }) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // TestComputePolicyHash_Deterministic verifies that the same policy always produces the same hash. |
| 34 | func TestComputePolicyHash_Deterministic(t *testing.T) { |
nothing calls this directly
no test coverage detected