mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-15 22:26:40 +02:00
Extract test helper function checkRemoteBranches
We'll need it a few more times in the next test we add.
This commit is contained in:
parent
92bce7de43
commit
0b0910573b
@ -150,24 +150,12 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.Views().Remotes().
|
checkRemoteBranches(t, keys, "origin", []string{
|
||||||
Focus().
|
"branch-five",
|
||||||
Lines(Contains("origin")).
|
"branch-four",
|
||||||
PressEnter()
|
"branch-six",
|
||||||
|
"branch-two",
|
||||||
t.Views().
|
})
|
||||||
RemoteBranches().
|
|
||||||
Lines(
|
|
||||||
Equals("branch-five"),
|
|
||||||
Equals("branch-four"),
|
|
||||||
Equals("branch-six"),
|
|
||||||
Equals("branch-two"),
|
|
||||||
).
|
|
||||||
Press(keys.Universal.Return)
|
|
||||||
|
|
||||||
t.Views().
|
|
||||||
Branches().
|
|
||||||
Focus()
|
|
||||||
}).
|
}).
|
||||||
Lines(
|
Lines(
|
||||||
Contains("current-head"),
|
Contains("current-head"),
|
||||||
|
25
pkg/integration/tests/branch/shared.go
Normal file
25
pkg/integration/tests/branch/shared.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package branch
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
"github.com/samber/lo"
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkRemoteBranches(t *TestDriver, keys config.KeybindingConfig, remoteName string, expectedBranches []string) {
|
||||||
|
t.Views().Remotes().
|
||||||
|
Focus().
|
||||||
|
NavigateToLine(Contains(remoteName)).
|
||||||
|
PressEnter()
|
||||||
|
|
||||||
|
t.Views().
|
||||||
|
RemoteBranches().
|
||||||
|
Lines(
|
||||||
|
lo.Map(expectedBranches, func(branch string, _ int) *TextMatcher { return Equals(branch) })...,
|
||||||
|
).
|
||||||
|
Press(keys.Universal.Return)
|
||||||
|
|
||||||
|
t.Views().
|
||||||
|
Branches().
|
||||||
|
Focus()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user