Skip to content

Commit

Permalink
[wip] add test
Browse files Browse the repository at this point in the history
  • Loading branch information
noahfraiture committed May 23, 2024
1 parent 79c5b7b commit 15cf8c5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions pkg/integration/tests/branch/squash.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package branch

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)

var Squash = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squash a branch in the working tree",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().TopLines(
Contains("first change"),
Contains("original"),
)

t.Views().Branches().
Focus().
Lines(
Contains("change-branch"),
Contains("original-branch"),
).
SelectNextItem().
Press(keys.Branches.SquashBranch)

t.ExpectPopup().Menu().
Title(Equals("Squash")).
Select(Contains("Squash files in a new commit")).
Confirm()

t.Views().Commits().TopLines(
Contains("Squash branch change-branch into original-branch"),
Contains("first change"),
Contains("original"),
)
},
})

0 comments on commit 15cf8c5

Please sign in to comment.