1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

Improve updateRef test

This test not only tests the correct handling and display of the updateRef
command, but also the visualization of branch heads in the commits panel. Since
we are about to change the behavior here, extend the test so that a master
commit is added (we don't want this to be visualized as a branch head), and then
a stack of two non-main branches. At the end of this branch we only want to
visualize the head commit of the first.
This commit is contained in:
Stefan Haller 2023-06-21 21:45:03 +02:00
parent 9c57444adc
commit cb240081a8

View File

@ -13,9 +13,11 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateNCommits(3).
NewBranch("mybranch").
CreateNCommitsStartingAt(3, 4)
CreateNCommits(1).
NewBranch("branch1").
CreateNCommitsStartingAt(3, 2).
NewBranch("branch2").
CreateNCommitsStartingAt(3, 5)
shell.SetConfig("rebase.updateRefs", "true")
},
@ -23,26 +25,28 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Commits().
Focus().
Lines(
Contains("commit 06").IsSelected(),
Contains("commit 07").IsSelected(),
Contains("commit 06"),
Contains("commit 05"),
Contains("commit 04"),
Contains("commit 03"),
Contains("commit 02"),
Contains("commit 01"),
).
NavigateToLine(Contains("commit 01")).
NavigateToLine(Contains("commit 02")).
Press(keys.Universal.Edit).
Focus().
Lines(
Contains("pick").Contains("commit 07"),
Contains("pick").Contains("commit 06"),
Contains("pick").Contains("commit 05"),
Contains("update-ref").Contains("branch1"),
Contains("pick").Contains("commit 04"),
Contains("update-ref").Contains("master"),
Contains("pick").Contains("commit 03"),
Contains("pick").Contains("commit 02"),
Contains("<-- YOU ARE HERE --- commit 01"),
Contains("<-- YOU ARE HERE --- commit 02"),
Contains("commit 01"),
).
NavigateToLine(Contains("commit 05")).
NavigateToLine(Contains("commit 06")).
Press(keys.Universal.Remove)
t.Common().ContinueRebase()
@ -50,7 +54,8 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Commits().
IsFocused().
Lines(
Contains("commit 06"),
Contains("commit 07"),
Contains("commit 05"),
Contains("commit 04"),
Contains("commit 03"),
Contains("commit 02"),