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,32 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/integration/helpers"
)
var Commit = helpers.NewTest(helpers.NewTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *helpers.Shell) {
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *helpers.Shell, input *helpers.Impl, assert *helpers.Assert, keys config.KeybindingConfig) {
assert.CommitCount(0)
input.Select()
input.NextItem()
input.Select()
input.PressKeys(keys.Files.CommitChanges)
commitMessage := "my commit message"
input.Type(commitMessage)
input.Confirm()
assert.CommitCount(1)
assert.HeadCommitMessage(commitMessage)
},
})