1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/integration/tests/custom_commands/basic.go

35 lines
835 B
Go
Raw Normal View History

2022-08-14 11:15:21 +02:00
package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Basic = components.NewIntegrationTest(components.NewIntegrationTestArgs{
Description: "Using a custom command to create a new file",
ExtraCmdArgs: "",
Skip: false,
SetupRepo: func(shell *components.Shell) {},
SetupConfig: func(cfg *config.AppConfig) {
cfg.UserConfig.CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: "touch myfile",
},
}
},
Run: func(
shell *components.Shell,
input *components.Input,
assert *components.Assert,
keys config.KeybindingConfig,
) {
assert.WorkingTreeFileCount(0)
input.PressKeys("a")
assert.WorkingTreeFileCount(1)
assert.SelectedLineContains("myfile")
},
})