1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-29 23:17:32 +02:00

Add test for rewording a merge commit

This currently fails with an error.
This commit is contained in:
Stefan Haller 2025-05-10 18:15:26 +02:00
parent b02441cdca
commit 50b2aa5843
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,56 @@
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RewordMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords a merge commit which is not the current head commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("base").
NewBranch("first-branch").
CreateFileAndAdd("file1.txt", "content").
Commit("one").
Checkout("master").
Merge("first-branch").
NewBranch("second-branch").
EmptyCommit("two")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("CI ◯ two").IsSelected(),
Contains("CI ⏣─╮ Merge branch 'first-branch'"),
Contains("CI │ ◯ one"),
Contains("CI ◯─╯ base"),
).
SelectNextItem().
Press(keys.Commits.RenameCommit).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Reword commit")).
InitialText(Equals("Merge branch 'first-branch'")).
Clear().
Type("renamed merge").
Confirm()
}).
/* EXPECTED:
Lines(
Contains("CI ◯ two"),
Contains("CI ⏣─╮ renamed merge").IsSelected(),
Contains("CI │ ◯ one"),
Contains("CI ◯ ╯ base"),
)
ACTUAL: */
Tap(func() {
t.ExpectPopup().Alert().Title(Equals("Error")).
Content(Contains("error: 'edit' does not accept merge commits"))
})
},
})

View File

@ -275,6 +275,7 @@ var tests = []*components.IntegrationTest{
interactive_rebase.RewordFirstCommit,
interactive_rebase.RewordLastCommit,
interactive_rebase.RewordLastCommitOfStackedBranch,
interactive_rebase.RewordMergeCommit,
interactive_rebase.RewordYouAreHereCommit,
interactive_rebase.RewordYouAreHereCommitWithEditor,
interactive_rebase.ShowExecTodos,