blob: 65a10e31b0d8029714d69454d73592050e5f9731 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to another branch",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("current-branch")
shell.EmptyCommit("root commit")
shell.NewBranch("other-branch")
shell.EmptyCommit("other-branch commit")
shell.Checkout("current-branch")
shell.EmptyCommit("current-branch commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("current-branch commit"),
Contains("root commit"),
)
t.Views().Branches().
Focus().
Lines(
Contains("current-branch"),
Contains("other-branch"),
).
SelectNextItem().
Press(keys.Commits.ViewResetOptions)
t.ExpectMenu().Title(Contains("reset to other-branch")).Select(Contains("hard reset")).Confirm()
// assert that we now have the expected commits in the commit panel
t.Views().Commits().
Lines(
Contains("other-branch commit"),
Contains("root commit"),
)
},
})
|