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:
committed by
Jesse Duffield
parent
bfcbf228bf
commit
50b0d85cd3
34
pkg/integration/tests/commit/staged_without_hooks.go
Normal file
34
pkg/integration/tests/commit/staged_without_hooks.go
Normal 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")
|
||||
},
|
||||
})
|
33
pkg/integration/tests/commit/unstaged_without_hooks.go
Normal file
33
pkg/integration/tests/commit/unstaged_without_hooks.go
Normal 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")
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user