summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorAndrew Hynes <andrew.hynes@colabsoftware.com>2022-10-06 22:53:13 -0230
committerAndrew Hynes <andrew.hynes@colabsoftware.com>2022-10-06 22:53:13 -0230
commita30d924afe8e996dd0517bc70855803858efc362 (patch)
treef1756b6c9fe692ec21e5bc74c79dcd6283008571 /pkg/integration
parentf4c188fa5b069a1d0714dc9508cecfa55eaddf46 (diff)
test: add test for stash including untracked files
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/tests/stash/stash.go2
-rw-r--r--pkg/integration/tests/stash/stash_including_untracked_files.go33
-rw-r--r--pkg/integration/tests/tests.go1
3 files changed, 36 insertions, 0 deletions
diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go
index db9e13b78..af247550b 100644
--- a/pkg/integration/tests/stash/stash.go
+++ b/pkg/integration/tests/stash/stash.go
@@ -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)
},
})
diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go
new file mode 100644
index 000000000..4ed7957ac
--- /dev/null
+++ b/pkg/integration/tests/stash/stash_including_untracked_files.go
@@ -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)
+ },
+})
diff --git a/pkg/integration/tests/tests.go b/pkg/integration/tests/tests.go
index fd42f0ed6..028e990ee 100644
--- a/pkg/integration/tests/tests.go
+++ b/pkg/integration/tests/tests.go
@@ -29,6 +29,7 @@ var tests = []*components.IntegrationTest{
custom_commands.MultiplePrompts,
custom_commands.MenuFromCommand,
stash.Stash,
+ stash.StashIncludingUntrackedFiles,
}
func GetTests() []*components.IntegrationTest {