summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/stash/rename.go
blob: 97cfae006dd91f44fb8e489d0559dc8f8e92279e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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"))
	},
})