1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00
lazygit/pkg/integration/tests/branch/rebase_copied_branch.go
Stefan Haller af6d072cc6 Add tests demonstrating undesired behavior with update-ref todos for copied branches
These tests succeed here, but have comments explaining which bits are undesired.
See next commit for a more detailed explanation why.
2024-04-22 20:59:15 +02:00

70 lines
1.8 KiB
Go

package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RebaseCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Make a copy of a branch, rebase it, check that the original branch is unaffected",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {
config.AppState.GitLogShowGraph = "never"
},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("master 1").
EmptyCommit("master 2").
NewBranchFrom("branch1", "master^").
EmptyCommit("branch 1").
EmptyCommit("branch 2").
NewBranch("branch2")
shell.SetConfig("rebase.updateRefs", "true")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("CI * branch 2"),
Contains("CI branch 1"),
Contains("CI master 1"),
)
t.Views().Branches().
Focus().
Lines(
Contains("branch2").IsSelected(),
Contains("branch1"),
Contains("master"),
).
NavigateToLine(Contains("master")).
Press(keys.Branches.RebaseBranch).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Rebase 'branch2' onto 'master'")).
Select(Contains("Simple rebase")).
Confirm()
})
t.Views().Commits().Lines(
Contains("CI * branch 2"), // wrong, don't want a star here
Contains("CI branch 1"),
Contains("CI master 2"),
Contains("CI master 1"),
)
t.Views().Branches().
Focus().
NavigateToLine(Contains("branch1")).
PressPrimaryAction()
t.Views().Commits().Lines(
Contains("CI * branch 2"), // wrong, don't want a star here
Contains("CI branch 1"),
Contains("CI master 2"), // wrong, don't want this commit
Contains("CI master 1"),
)
},
})