mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
update test
This commit is contained in:
committed by
Luka Markušić
parent
0141bbde0e
commit
23d39c79b2
@ -5,6 +5,11 @@ import (
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var (
|
||||
postMergeFileContent = "post merge file content"
|
||||
postMergeFilename = "post-merge-file"
|
||||
)
|
||||
|
||||
var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Amends a staged file to a merge commit.",
|
||||
ExtraCmdArgs: "",
|
||||
@ -13,14 +18,14 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
NewBranch("development-branch").
|
||||
CreateFileAndAdd("initial-file", "content").
|
||||
CreateFileAndAdd("initial-file", "initial file content").
|
||||
Commit("initial commit").
|
||||
NewBranch("feature-branch"). // it's also checked out automatically
|
||||
CreateFileAndAdd("new-feature-file", "new content").
|
||||
Commit("new feature commit").
|
||||
CheckoutBranch("development-branch").
|
||||
Checkout("development-branch").
|
||||
Merge("feature-branch").
|
||||
CreateFileAndAdd("post-merge-file", "content")
|
||||
CreateFileAndAdd(postMergeFilename, postMergeFileContent)
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(3)
|
||||
@ -28,10 +33,18 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.SwitchToCommitsWindow()
|
||||
assert.CurrentViewName("commits")
|
||||
|
||||
input.PressKeys(keys.Commits.AmendToCommit)
|
||||
input.PressKeys(keys.Universal.Return)
|
||||
mergeCommitMessage := "Merge branch 'feature-branch' into development-branch"
|
||||
assert.MatchHeadCommitMessage(Contains(mergeCommitMessage))
|
||||
|
||||
assert.MatchHeadCommitMessage(Contains("Merge"))
|
||||
input.PressKeys(keys.Commits.AmendToCommit)
|
||||
input.ProceedWhenAsked(Contains("Are you sure you want to amend this commit with your staged files?"))
|
||||
|
||||
// assuring we haven't added a brand new commit
|
||||
assert.CommitCount(3)
|
||||
assert.MatchHeadCommitMessage(Contains(mergeCommitMessage))
|
||||
|
||||
// assuring the post-merge file shows up in the merge commit.
|
||||
assert.MatchMainViewContent(Contains(postMergeFilename))
|
||||
assert.MatchMainViewContent(Contains("++" + postMergeFileContent))
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user