summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/branch/delete.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-08-22 20:02:40 +1000
committerJesse Duffield <jessedduffield@gmail.com>2022-09-09 20:55:47 -0700
commit843488bff4b128f5227657f0e16dd42299420532 (patch)
tree417eb68e9258caba49c363d30c53e9437a795160 /pkg/integration/tests/branch/delete.go
parenta9d4ff2aee1ef6f6baf976d90452570afbdba67b (diff)
add branch delete integration test
Diffstat (limited to 'pkg/integration/tests/branch/delete.go')
-rw-r--r--pkg/integration/tests/branch/delete.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go
new file mode 100644
index 000000000..46df9a457
--- /dev/null
+++ b/pkg/integration/tests/branch/delete.go
@@ -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"))
+ },
+})