1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +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")
},
})

View File

@ -38,6 +38,8 @@ var tests = []*components.IntegrationTest{
commit.NewBranch,
commit.Staged,
commit.Unstaged,
commit.StagedWithoutHooks,
commit.UnstagedWithoutHooks,
custom_commands.Basic,
custom_commands.FormPrompts,
custom_commands.MenuFromCommand,

View File

@ -0,0 +1 @@
WIPmy commit message

View File

@ -0,0 +1 @@
ref: refs/heads/master

View File

@ -0,0 +1,12 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false
[protocol "file"]
allow = always

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 4a33e6274dd3bc702442966e6774e7688bb7af64 CI <CI@example.com> 1669660775 +0100 commit (initial): WIPmy commit message

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 4a33e6274dd3bc702442966e6774e7688bb7af64 CI <CI@example.com> 1669660775 +0100 commit (initial): WIPmy commit message

View File

@ -0,0 +1 @@
4a33e6274dd3bc702442966e6774e7688bb7af64

View File

@ -0,0 +1,2 @@
myfile content
with a second line

View File

@ -0,0 +1 @@
myfile2 content

View File

@ -0,0 +1 @@
WIPmy commit message

View File

@ -0,0 +1 @@
ref: refs/heads/master

View File

@ -0,0 +1,12 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false
[protocol "file"]
allow = always

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 ebc03af0e92eb50f1ab1dec0697880ed9da9b02d CI <CI@example.com> 1669660788 +0100 commit (initial): WIPmy commit message

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 ebc03af0e92eb50f1ab1dec0697880ed9da9b02d CI <CI@example.com> 1669660788 +0100 commit (initial): WIPmy commit message

View File

@ -0,0 +1 @@
x+)JMU06a040031QČ­LËĚIe`xäf×ĹvYRú†j°\ě~µ]‡tł ö Î

View File

@ -0,0 +1 @@
ebc03af0e92eb50f1ab1dec0697880ed9da9b02d

View File

@ -0,0 +1,2 @@
myfile content
with a second line

View File

@ -0,0 +1 @@
myfile2 content