1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-17 01:42:45 +02:00

integration tests for commit without pre-commit hooks in staging files menu

This commit is contained in:
Arnaud PERALTA
2022-11-28 19:40:29 +01:00
committed by Jesse Duffield
parent bfcbf228bf
commit 50b0d85cd3
36 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing without pre-commit hooks",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.CommitCount(0)
input.PrimaryAction()
input.Confirm()
input.PrimaryAction()
input.PressKeys(keys.Files.CommitChangesWithoutHook)
commitMessage := "my commit message"
input.Type(commitMessage)
input.Confirm()
assert.CommitCount(1)
assert.MatchHeadCommitMessage(Equals("WIP" + commitMessage))
assert.CurrentWindowName("stagingSecondary")
},
})

View File

@ -0,0 +1,33 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var UnstagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing without pre-commit hooks",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.CommitCount(0)
input.Confirm()
input.PrimaryAction()
input.PressKeys(keys.Files.CommitChangesWithoutHook)
commitMessage := "my commit message"
input.Type(commitMessage)
input.Confirm()
assert.CommitCount(1)
assert.MatchHeadCommitMessage(Equals("WIP" + commitMessage))
assert.CurrentWindowName("staging")
},
})