mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
test: add an integration test for rename stash
This commit is contained in:
@ -111,3 +111,8 @@ func (s *Shell) CreateNCommits(n int) *Shell {
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Shell) StashWithMessage(message string) *Shell {
|
||||
s.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
|
||||
return s
|
||||
}
|
||||
|
33
pkg/integration/tests/stash/rename.go
Normal file
33
pkg/integration/tests/stash/rename.go
Normal file
@ -0,0 +1,33 @@
|
||||
package stash
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Try to rename the stash.",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("blah").
|
||||
CreateFileAndAdd("foo", "change to stash").
|
||||
StashWithMessage("bar")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
input.SwitchToStashWindow()
|
||||
assert.CurrentViewName("stash")
|
||||
|
||||
assert.MatchSelectedLine(Equals("On master: bar"))
|
||||
input.PressKeys(keys.Stash.RenameStash)
|
||||
assert.InPrompt()
|
||||
assert.MatchCurrentViewTitle(Equals("Rename stash: stash@{0}"))
|
||||
|
||||
input.Type(" baz")
|
||||
input.Confirm()
|
||||
|
||||
assert.MatchSelectedLine(Equals("On master: bar baz"))
|
||||
},
|
||||
})
|
@ -16,6 +16,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"
|
||||
)
|
||||
|
||||
// Here is where we lists the actual tests that will run. When you create a new test,
|
||||
@ -38,6 +39,7 @@ var tests = []*components.IntegrationTest{
|
||||
cherry_pick.CherryPick,
|
||||
cherry_pick.CherryPickConflicts,
|
||||
custom_commands.FormPrompts,
|
||||
stash.Rename,
|
||||
}
|
||||
|
||||
func GetTests() []*components.IntegrationTest {
|
||||
|
Reference in New Issue
Block a user