mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
combine assert and input structs, clean up interface
This commit is contained in:
@ -27,26 +27,27 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Merge("feature-branch").
|
||||
CreateFileAndAdd(postMergeFilename, postMergeFileContent)
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.Model().CommitCount(3)
|
||||
|
||||
input.SwitchToCommitsView()
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Model().CommitCount(3)
|
||||
|
||||
mergeCommitMessage := "Merge branch 'feature-branch' into development-branch"
|
||||
assert.Model().HeadCommitMessage(Contains(mergeCommitMessage))
|
||||
input.Model().HeadCommitMessage(Contains(mergeCommitMessage))
|
||||
|
||||
input.Press(keys.Commits.AmendToCommit)
|
||||
input.Confirmation().
|
||||
input.Views().Commits().
|
||||
Focus().
|
||||
Press(keys.Commits.AmendToCommit)
|
||||
|
||||
input.ExpectConfirmation().
|
||||
Title(Equals("Amend Commit")).
|
||||
Content(Contains("Are you sure you want to amend this commit with your staged files?")).
|
||||
Confirm()
|
||||
|
||||
// assuring we haven't added a brand new commit
|
||||
assert.Model().CommitCount(3)
|
||||
assert.Model().HeadCommitMessage(Contains(mergeCommitMessage))
|
||||
input.Model().CommitCount(3)
|
||||
input.Model().HeadCommitMessage(Contains(mergeCommitMessage))
|
||||
|
||||
// assuring the post-merge file shows up in the merge commit.
|
||||
assert.Views().Main().
|
||||
input.Views().Main().
|
||||
Content(Contains(postMergeFilename)).
|
||||
Content(Contains("++" + postMergeFileContent))
|
||||
},
|
||||
|
@ -14,61 +14,56 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.
|
||||
CreateNCommits(5) // these will appears at commit 05, 04, 04, down to 01
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
input.SwitchToCommitsView()
|
||||
assert.Views().Current().Lines(
|
||||
Contains("commit 05"),
|
||||
Contains("commit 04"),
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
input.NavigateToListItem(Contains("commit 02"))
|
||||
input.Press(keys.Universal.Edit)
|
||||
|
||||
assert.Views().Current().Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("pick.*commit 04"),
|
||||
MatchesRegexp("pick.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
input.PreviousItem()
|
||||
input.Press(keys.Commits.MarkCommitAsFixup)
|
||||
assert.Views().Current().Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("pick.*commit 04"),
|
||||
MatchesRegexp("fixup.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
input.PreviousItem()
|
||||
input.Press(keys.Universal.Remove)
|
||||
assert.Views().Current().Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("drop.*commit 04"),
|
||||
MatchesRegexp("fixup.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
input.PreviousItem()
|
||||
input.Press(keys.Commits.SquashDown)
|
||||
|
||||
assert.Views().Current().Lines(
|
||||
MatchesRegexp("squash.*commit 05"),
|
||||
MatchesRegexp("drop.*commit 04"),
|
||||
MatchesRegexp("fixup.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) {
|
||||
input.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit 05"),
|
||||
Contains("commit 04"),
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToListItem(Contains("commit 02")).
|
||||
Press(keys.Universal.Edit).
|
||||
Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("pick.*commit 04"),
|
||||
MatchesRegexp("pick.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02").IsSelected(),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
SelectPreviousItem().
|
||||
Press(keys.Commits.MarkCommitAsFixup).
|
||||
Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("pick.*commit 04"),
|
||||
MatchesRegexp("fixup.*commit 03").IsSelected(),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
SelectPreviousItem().
|
||||
Press(keys.Universal.Remove).
|
||||
Lines(
|
||||
MatchesRegexp("pick.*commit 05"),
|
||||
MatchesRegexp("drop.*commit 04").IsSelected(),
|
||||
MatchesRegexp("fixup.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
SelectPreviousItem().
|
||||
Press(keys.Commits.SquashDown).
|
||||
Lines(
|
||||
MatchesRegexp("squash.*commit 05").IsSelected(),
|
||||
MatchesRegexp("drop.*commit 04"),
|
||||
MatchesRegexp("fixup.*commit 03"),
|
||||
MatchesRegexp("YOU ARE HERE.*commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
input.ContinueRebase()
|
||||
|
||||
assert.Views().Current().Lines(
|
||||
input.Views().Commits().Lines(
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
Reference in New Issue
Block a user