diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 16:27:36 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-27 21:26:18 +1100 |
commit | b166b8f776e45c77a94b6e919f3b9460ff3c2e06 (patch) | |
tree | 17459acf768779d92bae318fa631b2cc43aeb472 /pkg/integration/tests/stash | |
parent | c5c9f5bb941342766f86626ad13d30e5ce01980e (diff) |
combine assert and input structs, clean up interface
Diffstat (limited to 'pkg/integration/tests/stash')
-rw-r--r-- | pkg/integration/tests/stash/rename.go | 22 | ||||
-rw-r--r-- | pkg/integration/tests/stash/stash.go | 17 | ||||
-rw-r--r-- | pkg/integration/tests/stash/stash_including_untracked_files.go | 17 |
3 files changed, 29 insertions, 27 deletions
diff --git a/pkg/integration/tests/stash/rename.go b/pkg/integration/tests/stash/rename.go index 443f64a14..48eae4a99 100644 --- a/pkg/integration/tests/stash/rename.go +++ b/pkg/integration/tests/stash/rename.go @@ -18,18 +18,18 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{ CreateFileAndAdd("file-2", "change to stash2"). StashWithMessage("bar") }, - Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - input.SwitchToStashView() + Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { + input.Views().Stash(). + Focus(). + Lines( + Equals("On master: bar"), + Equals("On master: foo"), + ). + SelectNextItem(). + Press(keys.Stash.RenameStash) - assert.Views().Current().Lines( - Equals("On master: bar"), - Equals("On master: foo"), - ) - input.NextItem() - input.Press(keys.Stash.RenameStash) + input.ExpectPrompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() - input.Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() - - assert.Views().Current().SelectedLine(Equals("On master: foo baz")) + input.Views().Stash().SelectedLine(Equals("On master: foo baz")) }, }) diff --git a/pkg/integration/tests/stash/stash.go b/pkg/integration/tests/stash/stash.go index e506b150a..34e376886 100644 --- a/pkg/integration/tests/stash/stash.go +++ b/pkg/integration/tests/stash/stash.go @@ -15,17 +15,18 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("file", "content") shell.GitAddAll() }, - Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - assert.Model().StashCount(0) - assert.Model().WorkingTreeFileCount(1) + Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { + input.Model().StashCount(0) + input.Model().WorkingTreeFileCount(1) - input.Press(keys.Files.ViewStashOptions) + input.Views().Files(). + Press(keys.Files.ViewStashOptions) - input.Menu().Title(Equals("Stash options")).Select(MatchesRegexp("stash all changes$")).Confirm() + input.ExpectMenu().Title(Equals("Stash options")).Select(MatchesRegexp("stash all changes$")).Confirm() - input.Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() + input.ExpectPrompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() - assert.Model().StashCount(1) - assert.Model().WorkingTreeFileCount(0) + input.Model().StashCount(1) + input.Model().WorkingTreeFileCount(0) }, }) diff --git a/pkg/integration/tests/stash/stash_including_untracked_files.go b/pkg/integration/tests/stash/stash_including_untracked_files.go index 673bb1c04..d923aca3a 100644 --- a/pkg/integration/tests/stash/stash_including_untracked_files.go +++ b/pkg/integration/tests/stash/stash_including_untracked_files.go @@ -16,17 +16,18 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ shell.CreateFile("file_2", "content") shell.GitAdd("file_1") }, - Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) { - assert.Model().StashCount(0) - assert.Model().WorkingTreeFileCount(2) + Run: func(shell *Shell, input *Input, keys config.KeybindingConfig) { + input.Model().StashCount(0) + input.Model().WorkingTreeFileCount(2) - input.Press(keys.Files.ViewStashOptions) + input.Views().Files(). + Press(keys.Files.ViewStashOptions) - input.Menu().Title(Equals("Stash options")).Select(Contains("stash all changes including untracked files")).Confirm() + input.ExpectMenu().Title(Equals("Stash options")).Select(Contains("stash all changes including untracked files")).Confirm() - input.Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() + input.ExpectPrompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() - assert.Model().StashCount(1) - assert.Model().WorkingTreeFileCount(0) + input.Model().StashCount(1) + input.Model().WorkingTreeFileCount(0) }, }) |