1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-05 15:15:49 +02:00
2023-02-22 21:15:03 +11:00

50 lines
1.2 KiB
Go

package reflog
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to a reflog commit",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.HardReset("HEAD^^")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().ReflogCommits().
Focus().
Lines(
Contains("reset: moving to HEAD^^").IsSelected(),
Contains("commit: three"),
Contains("commit: two"),
Contains("commit (initial): one"),
).
SelectNextItem().
Press(keys.Commits.ViewResetOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Contains("reset to")).
Select(Contains("hard reset")).
Confirm()
}).
TopLines(
Contains("reset: moving to").IsSelected(),
Contains("reset: moving to HEAD^^"),
)
t.Views().Commits().
Focus().
Lines(
Contains("three").IsSelected(),
Contains("two"),
Contains("one"),
)
},
})