mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-10 11:10:18 +02:00
test: add test for basic stash
This commit is contained in:
parent
e189546acb
commit
db9373662a
@ -78,6 +78,17 @@ func (self *Assert) CommitCount(expectedCount int) {
|
||||
})
|
||||
}
|
||||
|
||||
func (self *Assert) StashCount(expectedCount int) {
|
||||
self.assertWithRetries(func() (bool, string) {
|
||||
actualCount := len(self.gui.Model().StashEntries)
|
||||
|
||||
return actualCount == expectedCount, fmt.Sprintf(
|
||||
"Expected %d stash entries, but got %d",
|
||||
expectedCount, actualCount,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func (self *Assert) MatchHeadCommitMessage(matcher *matcher) {
|
||||
self.assertWithRetries(func() (bool, string) {
|
||||
return len(self.gui.Model().Commits) > 0, "Expected at least one commit to be present"
|
||||
|
27
pkg/integration/tests/stash/stash.go
Normal file
27
pkg/integration/tests/stash/stash.go
Normal file
@ -0,0 +1,27 @@
|
||||
package stash
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var Stash = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Stashing files",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.CreateFile("file", "content")
|
||||
shell.GitAddAll()
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.StashCount(0)
|
||||
|
||||
input.PressKeys(keys.Files.ViewStashOptions)
|
||||
input.Confirm()
|
||||
input.Confirm()
|
||||
|
||||
assert.StashCount(1)
|
||||
},
|
||||
})
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
|
||||
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
|
||||
@ -27,6 +28,7 @@ var tests = []*components.IntegrationTest{
|
||||
custom_commands.Basic,
|
||||
custom_commands.MultiplePrompts,
|
||||
custom_commands.MenuFromCommand,
|
||||
stash.Stash,
|
||||
}
|
||||
|
||||
func GetTests() []*components.IntegrationTest {
|
||||
|
Loading…
Reference in New Issue
Block a user