1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Add integration test for resetting to upstream branch with duplicate name

This commit is contained in:
Chris McDonnell
2025-05-27 22:47:04 -04:00
committed by Stefan Haller
parent fa238809ae
commit 706891e92b
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,57 @@
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResetToDuplicateNamedUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset the current branch to an upstream branch when there is a competing tag name",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CloneIntoRemote("origin").
NewBranch("foo").
EmptyCommit("commit 1").
PushBranchAndSetUpstream("origin", "foo").
EmptyCommit("commit 2").
CreateLightweightTag("origin/foo", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("commit 2"),
Contains("commit 1"),
)
t.Views().Tags().Focus().Lines(Contains("origin/foo"))
t.Views().Remotes().Focus().
Lines(Contains("origin")).
PressEnter()
t.Views().RemoteBranches().IsFocused().
Lines(Contains("foo")).
Press(keys.Commits.ViewResetOptions)
t.ExpectPopup().Menu().
Title(Contains("Reset to origin/foo")).
Select(Contains("Hard reset")).
Confirm()
t.Views().Commits().Lines(
Contains("commit 1"),
)
t.Views().Tags().Focus().
Lines(Contains("origin/foo")).
Press(keys.Commits.ViewResetOptions)
t.ExpectPopup().Menu().
Title(Contains("Reset to origin/foo")).
Select(Contains("Hard reset")).
Confirm()
t.Views().Commits().Lines(
Contains("commit 2"),
Contains("commit 1"),
)
},
})