1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

basic custom command test

This commit is contained in:
Jesse Duffield
2022-08-14 19:15:21 +10:00
parent 4aea005f26
commit 9c0d860980
23 changed files with 50 additions and 36 deletions

View File

@ -0,0 +1,34 @@
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")
},
})