MCPcopy Create free account
hub / github.com/cli/cli / TestClientDeleteLocalBranchRemovesUnmergedBranch

Function TestClientDeleteLocalBranchRemovesUnmergedBranch

git/client_test.go:948–962  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

946}
947
948func TestClientDeleteLocalBranchRemovesUnmergedBranch(t *testing.T) {
949 // Given a feature branch with a commit that is not merged into trunk
950 repo := newTestRepo(t)
951 repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit")
952 repo.run(t, "checkout", "--quiet", "-b", "feature")
953 repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "unmerged feature work")
954 repo.run(t, "checkout", "--quiet", "trunk")
955
956 // When the branch is deleted
957 err := repo.client.DeleteLocalBranch(t.Context(), "feature")
958
959 // Then the branch no longer exists
960 require.NoError(t, err)
961 assert.False(t, repo.client.HasLocalBranch(t.Context(), "feature"), "deleted branch should not resolve")
962}
963
964func TestClientDeleteLocalBranchReportsCheckedOutBranch(t *testing.T) {
965 // Given a repository whose trunk branch is checked out

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
DeleteLocalBranchMethod · 0.80
HasLocalBranchMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected