mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02: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 {
|
||||
|
@ -0,0 +1 @@
|
||||
blah
|
@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
@ -0,0 +1 @@
|
||||
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
|
@ -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
|
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
BIN
test/integration_new/stash/rename/expected/repo/.git_keep/index
Normal file
BIN
test/integration_new/stash/rename/expected/repo/.git_keep/index
Normal file
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah
|
||||
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802396 +0900 reset: moving to HEAD
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah
|
@ -0,0 +1 @@
|
||||
0000000000000000000000000000000000000000 c6f35659c0cf57c794d79df88283d7ee933831dd CI <CI@example.com> 1665802399 +0900 On master: bar baz
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
x��A
|
||||
�0E��)f_(1��)�\y�d2��Q�)x��龋����ל���K�E@1��@�TmDi�&vU��r��f�,|j<u�Nc�^�I�MM����%V>e\w�x��K���Yn��'T����&��%k�QE��ʹ$9`] ������ �a4_��C^
|
@ -0,0 +1,2 @@
|
||||
x���
|
||||
�0�a�}��ɺ4$ "���h�� +�Q��w���烿�Z_/�p2�i)L��iFFOd�,�Qd5wR��?}kL3ܧ���\�J���`5�1���t����~�?+�
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf
|
@ -0,0 +1 @@
|
||||
c6f35659c0cf57c794d79df88283d7ee933831dd
|
Reference in New Issue
Block a user