-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cmdgit should match full branch name
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,6 +236,40 @@ func TestTable(t *testing.T) { | |
}, | ||
}, | ||
|
||
{ | ||
name: "existing branch with matching start", | ||
vcCreate: func(t *testing.T) *vcmock.VersionController { | ||
repo := createRepo(t, "owner", "should-change", "i like apples") | ||
changeBranch(t, repo.Path, "custom-branch-name-but-with-different-ending", true) | ||
changeTestFile(t, repo.Path, "i like apple", "test change") | ||
changeBranch(t, repo.Path, "master", false) | ||
return &vcmock.VersionController{ | ||
Repositories: []vcmock.Repository{ | ||
repo, | ||
}, | ||
} | ||
}, | ||
args: []string{ | ||
"run", | ||
"--author-name", "Test Author", | ||
"--author-email", "[email protected]", | ||
"--branch", "custom-branch-name", | ||
"-m", "custom message", | ||
changerBinaryPath, | ||
}, | ||
verify: func(t *testing.T, vcMock *vcmock.VersionController, runData runData) { | ||
require.Len(t, vcMock.PullRequests, 1) | ||
assert.Equal(t, "custom-branch-name", vcMock.PullRequests[0].Head) | ||
assert.Equal(t, "custom message", vcMock.PullRequests[0].Title) | ||
|
||
changeBranch(t, vcMock.Repositories[0].Path, "custom-branch-name", false) | ||
assert.Equal(t, "i like bananas", readTestFile(t, vcMock.Repositories[0].Path)) | ||
|
||
changeBranch(t, vcMock.Repositories[0].Path, "custom-branch-name-but-with-different-ending", false) | ||
assert.Equal(t, "i like apple", readTestFile(t, vcMock.Repositories[0].Path)) | ||
}, | ||
}, | ||
|
||
{ | ||
name: "reviewers", | ||
vcCreate: func(t *testing.T) *vcmock.VersionController { | ||
|