test: add test for stash including untracked files

This commit is contained in:
Andrew Hynes 2022-10-06 22:53:13 -02:30
parent f4c188fa5b
commit a30d924afe
24 changed files with 68 additions and 0 deletions

View file

@ -17,6 +17,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.StashCount(0)
assert.WorkingTreeFileCount(1)
input.PressKeys(keys.Files.ViewStashOptions)
assert.InMenu()
@ -26,5 +27,6 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{
input.Confirm()
assert.StashCount(1)
assert.WorkingTreeFileCount(0)
},
})

View file

@ -0,0 +1,33 @@
package stash
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stashing all files including untracked ones",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CreateFile("file_1", "content")
shell.CreateFile("file_2", "content")
shell.GitAdd("file_1")
},
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.StashCount(0)
assert.WorkingTreeFileCount(2)
input.PressKeys(keys.Files.ViewStashOptions)
assert.InMenu()
input.PressKeys("U")
input.Type("stash name")
input.Confirm()
assert.StashCount(1)
assert.WorkingTreeFileCount(0)
},
})

View file

@ -29,6 +29,7 @@ var tests = []*components.IntegrationTest{
custom_commands.MultiplePrompts,
custom_commands.MenuFromCommand,
stash.Stash,
stash.StashIncludingUntrackedFiles,
}
func GetTests() []*components.IntegrationTest {

View file

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

View file

@ -0,0 +1 @@
d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f

View file

@ -0,0 +1,12 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false

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,2 @@
0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105632 -0230 commit (initial): initial commit
d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105633 -0230 reset: moving to HEAD

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f CI <CI@example.com> 1665105632 -0230 commit (initial): initial commit

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 b8eb39e727d4ac91542d57faa0bea0458c2d30e3 CI <CI@example.com> 1665105633 -0230 On master: stash name

View file

@ -0,0 +1,2 @@
xЌПMJ1`Ч}Љ\@©Є¤т#"В¬fе
#<23>оЎ;З·7іwышxјЧ¶1ѕ¦уаџжnжT-"¶ђ«І9ХR:S(T2c…dMКr—ЭЦй”ёRЛв• aЕњCЇ[N"TK1MэбВ№0qЏН'Е”„ЅpТLјќ Е‡п™)K>KjгДђЕ*Ш3AВ°ИПјm»»\ЭЫеъaї2оЯцТсо0FFаиЅ{т°њйyzЪ?щт№є!Зй_Э1её№U†эяґY`

View file

@ -0,0 +1,2 @@
xЌЌ]
В0„}ОJ~7AЉ}к1нЉБ¦6ЏoА ш6 Я|Cµ”Ь@…pjsЮ“BШIo5Z­,&“RТ04Ћ|B+вСћuѓqоь‰еЅр…j№ЃBtJ:4ОR)zЫOя‰cm[¤ПрИ пPW(qпы+МЪ%Mтљ[Ћ ьФв Ћ:ћ

View file

@ -0,0 +1 @@
d25b2c8a3d20c1b1884fbf1c87aa2014dd99ed7f

View file

@ -0,0 +1 @@
b8eb39e727d4ac91542d57faa0bea0458c2d30e3