mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
add integration test for restoring a deleted branch
This commit is contained in:
parent
7da8a04187
commit
a133dc0dad
51
pkg/integration/tests/branch/restore_deleted_branch.go
Normal file
51
pkg/integration/tests/branch/restore_deleted_branch.go
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var RestoreDeletedBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Restore a deleted local branch from the reflog",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("base commit").
|
||||
NewBranch("feature").
|
||||
EmptyCommit("on feature").
|
||||
Checkout("master").
|
||||
EmptyCommit("on master").
|
||||
RunCommand([]string{"git", "branch", "-D", "feature"})
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Branches().
|
||||
Press(keys.Branches.RestoreBranch).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Menu().
|
||||
Title(Equals("Deleted branches")).
|
||||
ContainsLines(
|
||||
Contains("feature"),
|
||||
).
|
||||
Select(Contains("feature")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectToast(Contains("Restored branch 'feature'"))
|
||||
})
|
||||
|
||||
t.Views().Branches().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
Contains("feature"),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
@ -80,6 +80,7 @@ var tests = []*components.IntegrationTest{
|
|||
branch.ResetToDuplicateNamedTag,
|
||||
branch.ResetToDuplicateNamedUpstream,
|
||||
branch.ResetToUpstream,
|
||||
branch.RestoreDeletedBranch,
|
||||
branch.SelectCommitsOfCurrentBranch,
|
||||
branch.SetUpstream,
|
||||
branch.ShowDivergenceFromBaseBranch,
|
||||
|
|
|
|||
Loading…
Reference in a new issue