1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

integration tests for commit in staged files and unstaged files menus

This commit is contained in:
Arnaud PERALTA 2022-11-27 17:33:37 +01:00 committed by Jesse Duffield
parent d0499286e2
commit 87e0f6b92d
53 changed files with 147 additions and 0 deletions

View File

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

View File

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

View File

@ -36,6 +36,8 @@ var tests = []*components.IntegrationTest{
cherry_pick.CherryPickConflicts,
commit.Commit,
commit.NewBranch,
commit.Staged,
commit.Unstaged,
custom_commands.Basic,
custom_commands.FormPrompts,
custom_commands.MenuFromCommand,

View File

@ -0,0 +1 @@
my 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 ef3197feca3fdc5b9f0170f483c6ff138d5cf186 CI <CI@example.com> 1669566692 +0100 commit (initial): my commit message

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 ef3197feca3fdc5b9f0170f483c6ff138d5cf186 CI <CI@example.com> 1669566692 +0100 commit (initial): my commit message

View File

@ -0,0 +1,2 @@
x��A
Â0E]ç³$™iÆD„®zŒ1�ªà�ÒFÐÛðnþâñ?³G…yWWU Qœæc‘X)§._Ã,‚N„œ%öCtòª÷²Â0Âi/ú[žzÈÅΘûÈmö>xïm'UÿÔ�}à—€é¶ÉMݶ0

View File

@ -0,0 +1 @@
ef3197feca3fdc5b9f0170f483c6ff138d5cf186

View File

@ -0,0 +1 @@
myfile content

View File

@ -0,0 +1 @@
myfile2 content

View File

@ -0,0 +1 @@
my 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 28f8e24755d8792e66738e36f193949a68021709 CI <CI@example.com> 1669566470 +0100 commit (initial): my commit message

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 28f8e24755d8792e66738e36f193949a68021709 CI <CI@example.com> 1669566470 +0100 commit (initial): my commit message

View File

@ -0,0 +1 @@
28f8e24755d8792e66738e36f193949a68021709

View File

@ -0,0 +1 @@
myfile content

View File

@ -0,0 +1 @@
myfile2 content

View File

@ -0,0 +1 @@
my 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 d46951396fe8179592ec90aee0c0414fc0512fc5 CI <CI@example.com> 1669566705 +0100 commit (initial): my commit message

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 d46951396fe8179592ec90aee0c0414fc0512fc5 CI <CI@example.com> 1669566705 +0100 commit (initial): my commit message

View File

@ -0,0 +1 @@
d46951396fe8179592ec90aee0c0414fc0512fc5

View File

@ -0,0 +1 @@
myfile content

View File

@ -0,0 +1 @@
myfile2 content