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

Function TestResolveLatestRef_CommitSHA

pkg/cli/update_command_test.go:955–965  ·  view source on GitHub ↗

TestResolveLatestRef_CommitSHA tests that commit SHAs are correctly identified and trigger default branch resolution (which requires API access).

(t *testing.T)

Source from the content-addressed store, hash-verified

953// TestResolveLatestRef_CommitSHA tests that commit SHAs are correctly identified
954// and trigger default branch resolution (which requires API access).
955func 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
968func TestResolveLatestRef_NotCommitSHA(t *testing.T) {

Callers

nothing calls this directly

Calls 3

IsCommitSHAFunction · 0.85
resolveLatestRefFunction · 0.85
BackgroundMethod · 0.80

Tested by

no test coverage detected