mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Add test that demonstrates bug with deleting remote branch with different name
It's maybe not very common, but it's totally possible for a remote branch to have a different name than the local branch. This test shows that we don't support this properly when deleting the remote branch.
This commit is contained in:
parent
7e7309f97e
commit
be3683ccc8
2 changed files with 57 additions and 0 deletions
|
@ -0,0 +1,56 @@
|
|||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var DeleteRemoteBranchWithDifferentName = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Delete a remote branch that has a different name than the local branch",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.CloneIntoRemote("origin")
|
||||
shell.NewBranch("mybranch-local")
|
||||
shell.PushBranchAndSetUpstream("origin", "mybranch-local:mybranch-remote")
|
||||
shell.Checkout("master")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
Contains("mybranch-local ✓"),
|
||||
).
|
||||
SelectNextItem().
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Menu().
|
||||
Title(Equals("Delete branch 'mybranch-local'?")).
|
||||
Select(Contains("Delete remote branch")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Confirmation().
|
||||
/* EXPECTED:
|
||||
Title(Equals("Delete branch 'mybranch-remote'?")).
|
||||
Content(Equals("Are you sure you want to delete the remote branch 'mybranch-remote' from 'origin'?")).
|
||||
ACTUAL: */
|
||||
Title(Equals("Delete branch 'mybranch-local'?")).
|
||||
Content(Equals("Are you sure you want to delete the remote branch 'mybranch-local' from 'origin'?")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains("master"),
|
||||
/* EXPECTED:
|
||||
Contains("mybranch-local (upstream gone)").IsSelected(),
|
||||
ACTUAL: */
|
||||
Contains("mybranch-local ✓").IsSelected(),
|
||||
)
|
||||
},
|
||||
})
|
|
@ -43,6 +43,7 @@ var tests = []*components.IntegrationTest{
|
|||
branch.CreateTag,
|
||||
branch.Delete,
|
||||
branch.DeleteRemoteBranchWithCredentialPrompt,
|
||||
branch.DeleteRemoteBranchWithDifferentName,
|
||||
branch.DetachedHead,
|
||||
branch.NewBranchAutostash,
|
||||
branch.NewBranchFromRemoteTrackingDifferentName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue