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

add reset to tag test

This commit is contained in:
Jesse Duffield 2023-02-20 18:48:37 +11:00
parent daf8176dd7
commit ee8c31880c
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to a tag",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.CreateLightweightTag("tag", "HEAD^") // creating tag on commit "one"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("two"),
Contains("one"),
)
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
Press(keys.Commits.ViewResetOptions)
t.ExpectPopup().Menu().
Title(Contains("reset to tag")).
Select(Contains("hard reset")).
Confirm()
t.Views().Commits().Lines(
Contains("one"),
)
},
})

View File

@ -89,6 +89,7 @@ var tests = []*components.IntegrationTest{
tag.Checkout, tag.Checkout,
tag.CrudAnnotated, tag.CrudAnnotated,
tag.CrudLightweight, tag.CrudLightweight,
tag.Reset,
undo.UndoCheckoutAndDrop, undo.UndoCheckoutAndDrop,
undo.UndoDrop, undo.UndoDrop,
} }