diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-08-22 20:02:40 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-09-09 20:55:47 -0700 |
commit | 843488bff4b128f5227657f0e16dd42299420532 (patch) | |
tree | 417eb68e9258caba49c363d30c53e9437a795160 /pkg/integration/tests/branch/delete.go | |
parent | a9d4ff2aee1ef6f6baf976d90452570afbdba67b (diff) |
add branch delete integration test
Diffstat (limited to 'pkg/integration/tests/branch/delete.go')
-rw-r--r-- | pkg/integration/tests/branch/delete.go | 40 |
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")) + }, +}) |