summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/stash/rename.go
blob: 99036b7f64d1ed13f8f915b6edc99dc79e761359 (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
34
35
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("file-1", "change to stash1").
			StashWithMessage("foo").
			CreateFileAndAdd("file-2", "change to stash2").
			StashWithMessage("bar")
	},
	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
		input.SwitchToStashView()

		assert.CurrentView().Lines(
			Equals("On master: bar"),
			Equals("On master: foo"),
		)
		input.NextItem()
		input.Press(keys.Stash.RenameStash)

		input.Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm()

		assert.CurrentView().SelectedLine(Equals("On master: foo baz"))
	},
})