1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

test: add an integration test for rename stash

This commit is contained in:
Ryooooooga
2022-10-15 11:57:19 +09:00
parent eceb3a5aa6
commit e78e829e3a
23 changed files with 66 additions and 0 deletions

View File

@ -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
}

View 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"))
},
})

View File

@ -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 {

View File

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

View File

@ -0,0 +1 @@
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf

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,2 @@
0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802396 +0900 reset: moving to HEAD

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf CI <CI@example.com> 1665802395 +0900 commit (initial): blah

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000 c6f35659c0cf57c794d79df88283d7ee933831dd CI <CI@example.com> 1665802399 +0900 On master: bar baz

View File

@ -0,0 +1,2 @@
x<01><>A
<EFBFBD>0E<><45>)f_(1<><31>)<29>\y<>d2<64><32>Q<EFBFBD>)x<><78><EFBFBD><E9BE8B><EFBFBD><0F>ל<EFBFBD><02><>K<EFBFBD>E@1<><31>@<40>TmDi<44>&vU<17><1D>r<EFBFBD><72>f <0B>,|j<u<>Nc<>^<5E>I<EFBFBD>MM<10><><EFBFBD><EFBFBD>%V>e\w<>x<><78>K<EFBFBD><4B><EFBFBD>Yn<59><6E>'T<><54><EFBFBD><EFBFBD>&<26><>%k͹<6B>QE<51><45>ʹ$9`] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>a4_<34><5F>C^

View File

@ -0,0 +1,2 @@
x<01><><EFBFBD>
<EFBFBD>0 <0C>a<EFBFBD>}<7D><>ɺ4$ "<22><><EFBFBD>h<EFBFBD><68> +<2B>Q<EFBFBD><51>w<EFBFBD><77><EFBFBD><EFBFBD>Z_/<2F>p2<>i)L<><18>iFFOd<4F>,<2C>Qd5wR<77><52>?}kL3ܧ<33><DCA7><EFBFBD><>J<EFBFBD><18><>`5<>1<><31><EFBFBD>t<EFBFBD><74><07><>~<7E>?+<2B>

View File

@ -0,0 +1 @@
8d4897b3dcbb5c8fbc8fa8439ec7e9627c3159cf

View File

@ -0,0 +1 @@
c6f35659c0cf57c794d79df88283d7ee933831dd