mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
add branch delete integration test
This commit is contained in:
parent
a9d4ff2aee
commit
843488bff4
40
pkg/integration/tests/branch/delete.go
Normal file
40
pkg/integration/tests/branch/delete.go
Normal file
@ -0,0 +1,40 @@
|
||||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var Delete = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Try to delete the checked out branch first (to no avail), and then delete another branch.",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("blah").
|
||||
NewBranch("branch-one").
|
||||
NewBranch("branch-two")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
input.SwitchToBranchesWindow()
|
||||
assert.CurrentViewName("localBranches")
|
||||
|
||||
assert.MatchSelectedLine(Contains("branch-two"))
|
||||
input.PressKeys(keys.Universal.Remove)
|
||||
assert.InAlert()
|
||||
assert.MatchCurrentViewContent(Contains("You cannot delete the checked out branch!"))
|
||||
|
||||
input.Confirm()
|
||||
|
||||
input.NextItem()
|
||||
assert.MatchSelectedLine(Contains("branch-one"))
|
||||
input.PressKeys(keys.Universal.Remove)
|
||||
assert.InConfirm()
|
||||
assert.MatchCurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?"))
|
||||
input.Confirm()
|
||||
assert.CurrentViewName("localBranches")
|
||||
assert.MatchSelectedLine(Contains("master"))
|
||||
assert.MatchCurrentViewContent(NotContains("branch-one"))
|
||||
},
|
||||
})
|
@ -24,6 +24,7 @@ var tests = []*components.IntegrationTest{
|
||||
commit.Commit,
|
||||
commit.NewBranch,
|
||||
branch.Suggestions,
|
||||
branch.Delete,
|
||||
interactive_rebase.One,
|
||||
custom_commands.Basic,
|
||||
custom_commands.MultiplePrompts,
|
||||
|
@ -1 +0,0 @@
|
||||
file0
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/old-branch-3
|
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 commit (initial): file0
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from master to new-branch
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from new-branch to new-branch-2
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from new-branch-2 to new-branch-3
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from new-branch-3 to old-branch
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from old-branch to old-branch-2
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 checkout: moving from old-branch-2 to old-branch-3
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 commit (initial): file0
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 branch: Created from HEAD
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 branch: Created from HEAD
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 branch: Created from HEAD
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 branch: Created from HEAD
|
@ -1 +0,0 @@
|
||||
0000000000000000000000000000000000000000 21b436d66d2c515ad17285e53d9e6380d599b044 CI <CI@example.com> 1617684680 +1000 branch: Created from HEAD
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
21b436d66d2c515ad17285e53d9e6380d599b044
|
@ -1 +0,0 @@
|
||||
test0
|
@ -1 +0,0 @@
|
||||
{"KeyEvents":[{"Timestamp":483,"Mod":0,"Key":259,"Ch":0},{"Timestamp":787,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2021,"Mod":0,"Key":27,"Ch":0},{"Timestamp":2436,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2779,"Mod":0,"Key":256,"Ch":100},{"Timestamp":3275,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3971,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd $1
|
||||
|
||||
git init
|
||||
|
||||
git config user.email "CI@example.com"
|
||||
git config user.name "CI"
|
||||
|
||||
echo test0 > file0
|
||||
git add .
|
||||
git commit -am file0
|
||||
|
||||
git checkout -b new-branch
|
||||
git checkout -b new-branch-2
|
||||
git checkout -b new-branch-3
|
||||
git checkout -b old-branch
|
||||
git checkout -b old-branch-2
|
||||
git checkout -b old-branch-3
|
@ -1 +0,0 @@
|
||||
{ "description": "Checking out a branch with name suggestions", "speed": 100 }
|
@ -0,0 +1 @@
|
||||
blah
|
@ -0,0 +1 @@
|
||||
ref: refs/heads/branch-two
|
@ -8,3 +8,5 @@
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
||||
[commit]
|
||||
gpgSign = false
|
BIN
test/integration_new/branch/delete/expected/repo/.git_keep/index
Normal file
BIN
test/integration_new/branch/delete/expected/repo/.git_keep/index
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
0000000000000000000000000000000000000000 a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 commit (initial): blah
|
||||
a7222d091ed91af493b7173e4b09dd2de085031d a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 checkout: moving from master to branch-one
|
||||
a7222d091ed91af493b7173e4b09dd2de085031d a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 checkout: moving from branch-one to branch-two
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 branch: Created from HEAD
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 branch: Created from HEAD
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 a7222d091ed91af493b7173e4b09dd2de085031d CI <CI@example.com> 1661162427 +1000 commit (initial): blah
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
a7222d091ed91af493b7173e4b09dd2de085031d
|
@ -0,0 +1 @@
|
||||
a7222d091ed91af493b7173e4b09dd2de085031d
|
@ -0,0 +1 @@
|
||||
a7222d091ed91af493b7173e4b09dd2de085031d
|
Loading…
x
Reference in New Issue
Block a user