mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-06-20 01:19:23 +02:00
migrate fetchPrune integration test
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var FetchPrune = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Fetch from the remote with the 'prune' option set in the git config",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.UserConfig.Git.AutoFetch = false
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
// This option makes it so that git checks for deleted branches in the remote
|
||||
// upon fetching.
|
||||
shell.SetConfig("fetch.prune", "true")
|
||||
|
||||
shell.EmptyCommit("my commit message")
|
||||
|
||||
shell.NewBranch("branch_to_remove")
|
||||
shell.Checkout("master")
|
||||
shell.CloneIntoRemote("origin")
|
||||
shell.SetBranchUpstream("master", "origin/master")
|
||||
shell.SetBranchUpstream("branch_to_remove", "origin/branch_to_remove")
|
||||
|
||||
// # unbenownst to our test repo we're removing the branch on the remote, so upon
|
||||
// # fetching with prune: true we expect git to realise the remote branch is gone
|
||||
shell.RemoveRemoteBranch("origin", "branch_to_remove")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Branches().
|
||||
Lines(
|
||||
Contains("master"),
|
||||
Contains("branch_to_remove").DoesNotContain("upstream gone"),
|
||||
)
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.Fetch)
|
||||
|
||||
t.Views().Branches().
|
||||
Lines(
|
||||
Contains("master"),
|
||||
Contains("branch_to_remove").Contains("upstream gone"),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/misc"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
|
||||
)
|
||||
|
||||
// Here is where we lists the actual tests that will run. When you create a new test,
|
||||
@@ -64,6 +65,7 @@ var tests = []*components.IntegrationTest{
|
||||
diff.Diff,
|
||||
diff.DiffAndApplyPatch,
|
||||
diff.DiffCommits,
|
||||
sync.FetchPrune,
|
||||
}
|
||||
|
||||
func GetTests() []*components.IntegrationTest {
|
||||
|
||||
Reference in New Issue
Block a user