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:
38
pkg/integration/tests/commit/new_branch.go
Normal file
38
pkg/integration/tests/commit/new_branch.go
Normal 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)
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user