TestResolveLatestRef_CommitSHA tests that commit SHAs are correctly identified and trigger default branch resolution (which requires API access).
(t *testing.T)
| 953 | // TestResolveLatestRef_CommitSHA tests that commit SHAs are correctly identified |
| 954 | // and trigger default branch resolution (which requires API access). |
| 955 | func TestResolveLatestRef_CommitSHA(t *testing.T) { |
| 956 | sha := "ea350161ad5dcc9624cf510f134c6a9e39a6f94d" |
| 957 | assert.True(t, IsCommitSHA(sha), "Should be recognized as a commit SHA") |
| 958 | |
| 959 | // resolveLatestRef for a SHA requires GitHub API access to look up the |
| 960 | // default branch. In environments without API access it will error; |
| 961 | // in authenticated environments it will succeed. Either outcome is |
| 962 | // acceptable — the key invariant is that the SHA is correctly |
| 963 | // identified (tested above) and the function does not panic. |
| 964 | _, _ = resolveLatestRef(context.Background(), "test/repo", sha, false, false, 0) |
| 965 | } |
| 966 | |
| 967 | // TestResolveLatestRef_NotCommitSHA tests that non-SHA refs are handled appropriately |
| 968 | func TestResolveLatestRef_NotCommitSHA(t *testing.T) { |
nothing calls this directly
no test coverage detected