1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

move code from main into app package to allow test to be injected

This commit is contained in:
Jesse Duffield
2022-08-09 21:27:12 +10:00
parent d890238c7b
commit ba96baee32
68 changed files with 1096 additions and 482 deletions

View File

@ -0,0 +1,38 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/integration/helpers"
)
var NewBranch = helpers.NewTest(helpers.NewTestArgs{
Description: "Creating a new branch from a commit",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *helpers.Shell) {
shell.
EmptyCommit("commit 1").
EmptyCommit("commit 2").
EmptyCommit("commit 3")
},
Run: func(shell *helpers.Shell, input *helpers.Impl, assert *helpers.Assert, keys config.KeybindingConfig) {
assert.CommitCount(3)
input.SwitchToCommitsWindow()
assert.CurrentViewName("commits")
input.NextItem()
input.PressKeys(keys.Universal.New)
assert.CurrentViewName("confirmation")
branchName := "my-branch-name"
input.Type(branchName)
input.Confirm()
assert.CommitCount(2)
assert.HeadCommitMessage("commit 2")
assert.CurrentBranchName(branchName)
},
})