diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-24 17:01:26 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-12-24 19:14:52 +1100 |
commit | aedfce28459bc59865b516dba2ee480a5d0972f1 (patch) | |
tree | 6bc47a03cce14f5daeeeb27534b326bce939b553 /pkg/integration/tests | |
parent | c19f52255c1d5496713e4f4caba47382fd10c9fc (diff) |
refactor to not have Match at the start of assert method names, because it reads better that way
Diffstat (limited to 'pkg/integration/tests')
34 files changed, 196 insertions, 196 deletions
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index 0c9494b82..0b81bbcb3 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -26,16 +26,16 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ } markCommitAsBad := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.Confirm() } markCommitAsGood := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.NextItem() - assert.MatchSelectedLine(Contains("good")) + assert.SelectedLine(Contains("good")) input.Confirm() } @@ -44,16 +44,16 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("commit 10")) + assert.SelectedLine(Contains("commit 10")) input.NavigateToListItemContainingText("commit 09") markCommitAsBad() - assert.MatchViewContent("information", Contains("bisecting")) + assert.ViewContent("information", Contains("bisecting")) assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("<-- bad")) + assert.SelectedLine(Contains("<-- bad")) input.NavigateToListItemContainingText("commit 02") @@ -61,26 +61,26 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ // lazygit will land us in the comit between our good and bad commits. assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("commit 05")) - assert.MatchSelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 05")) + assert.SelectedLine(Contains("<-- current")) markCommitAsBad() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("commit 04")) - assert.MatchSelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 04")) + assert.SelectedLine(Contains("<-- current")) markCommitAsGood() assert.InAlert() - assert.MatchCurrentViewContent(Contains("Bisect complete!")) + assert.CurrentViewContent(Contains("Bisect complete!")) // commit 5 is the culprit because we marked 4 as good and 5 as bad. - assert.MatchCurrentViewContent(Contains("commit 05")) - assert.MatchCurrentViewContent(Contains("Do you want to reset")) + assert.CurrentViewContent(Contains("commit 05")) + assert.CurrentViewContent(Contains("Do you want to reset")) input.Confirm() assert.CurrentViewName("commits") - assert.MatchCurrentViewContent(Contains("commit 04")) - assert.MatchViewContent("information", NotContains("bisecting")) + assert.CurrentViewContent(Contains("commit 04")) + assert.ViewContent("information", NotContains("bisecting")) }, }) diff --git a/pkg/integration/tests/bisect/from_other_branch.go b/pkg/integration/tests/bisect/from_other_branch.go index 4ef9a4d73..52314518f 100644 --- a/pkg/integration/tests/bisect/from_other_branch.go +++ b/pkg/integration/tests/bisect/from_other_branch.go @@ -31,39 +31,39 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{ markCommitAsGood := func() { viewBisectOptions() - assert.MatchSelectedLine(Contains("bad")) + assert.SelectedLine(Contains("bad")) input.NextItem() - assert.MatchSelectedLine(Contains("good")) + assert.SelectedLine(Contains("good")) input.Confirm() } - assert.MatchViewContent("information", Contains("bisecting")) + assert.ViewContent("information", Contains("bisecting")) assert.AtLeastOneCommit() input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("<-- bad")) - assert.MatchSelectedLine(Contains("commit 08")) + assert.SelectedLine(Contains("<-- bad")) + assert.SelectedLine(Contains("commit 08")) input.NextItem() - assert.MatchSelectedLine(Contains("<-- current")) - assert.MatchSelectedLine(Contains("commit 07")) + assert.SelectedLine(Contains("<-- current")) + assert.SelectedLine(Contains("commit 07")) markCommitAsGood() assert.InAlert() - assert.MatchCurrentViewContent(Contains("Bisect complete!")) - assert.MatchCurrentViewContent(Contains("commit 08")) - assert.MatchCurrentViewContent(Contains("Do you want to reset")) + assert.CurrentViewContent(Contains("Bisect complete!")) + assert.CurrentViewContent(Contains("commit 08")) + assert.CurrentViewContent(Contains("Do you want to reset")) input.Confirm() - assert.MatchViewContent("information", NotContains("bisecting")) + assert.ViewContent("information", NotContains("bisecting")) // back in master branch which just had the one commit assert.CurrentViewName("commits") assert.CommitCount(1) - assert.MatchSelectedLine(Contains("only commit on master")) + assert.SelectedLine(Contains("only commit on master")) }, }) diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index 4888b0112..956a2c36b 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -21,19 +21,19 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("master")) + assert.SelectedLine(Contains("master")) input.NextItem() - assert.MatchSelectedLine(Contains("@")) + assert.SelectedLine(Contains("@")) input.PressKeys(keys.Branches.CheckoutBranchByName) assert.InPrompt() - assert.MatchCurrentViewTitle(Equals("Branch name:")) + assert.CurrentViewTitle(Equals("Branch name:")) input.Type("new-branch") input.Confirm() assert.InAlert() - assert.MatchCurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?")) + assert.CurrentViewContent(Equals("Branch not found. Create a new branch named new-branch?")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("new-branch")) + assert.SelectedLine(Contains("new-branch")) }, }) diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 46df9a457..148544563 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -20,21 +20,21 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("branch-two")) + assert.SelectedLine(Contains("branch-two")) input.PressKeys(keys.Universal.Remove) assert.InAlert() - assert.MatchCurrentViewContent(Contains("You cannot delete the checked out branch!")) + assert.CurrentViewContent(Contains("You cannot delete the checked out branch!")) input.Confirm() input.NextItem() - assert.MatchSelectedLine(Contains("branch-one")) + assert.SelectedLine(Contains("branch-one")) input.PressKeys(keys.Universal.Remove) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?")) + assert.CurrentViewContent(Contains("Are you sure you want to delete the branch 'branch-one'?")) input.Confirm() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("master")) - assert.MatchCurrentViewContent(NotContains("branch-one")) + assert.SelectedLine(Contains("master")) + assert.CurrentViewContent(NotContains("branch-one")) }, }) diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index f894c42cb..a398b0993 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -18,21 +18,21 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.PressKeys(keys.Branches.RebaseBranch) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) + assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) input.Confirm() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke @@ -41,13 +41,13 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ assert.CurrentViewName("mergeConflicts") input.PrimaryAction() - assert.MatchViewContent("information", Contains("rebasing")) + assert.ViewContent("information", Contains("rebasing")) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() - assert.MatchViewContent("information", NotContains("rebasing")) + assert.ViewContent("information", NotContains("rebasing")) // this proves we actually have integrated the changes from second-change-branch - assert.MatchViewContent("commits", Contains("second-change-branch unrelated change")) + assert.ViewContent("commits", Contains("second-change-branch unrelated change")) }, }) diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 5600997b3..2269f0292 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -21,30 +21,30 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.PressKeys(keys.Branches.RebaseBranch) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) + assert.CurrentViewContent(Contains("Are you sure you want to rebase 'first-change-branch' on top of 'second-change-branch'?")) input.Confirm() - assert.MatchViewContent("information", Contains("rebasing")) + assert.ViewContent("information", Contains("rebasing")) assert.InConfirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) input.SwitchToCommitsWindow() - assert.MatchSelectedLine(Contains("pick")) // this means it's a rebasing commit + assert.SelectedLine(Contains("pick")) // this means it's a rebasing commit input.NextItem() input.PressKeys(keys.Universal.Remove) - assert.MatchSelectedLine(Contains("to remove")) - assert.MatchSelectedLine(Contains("drop")) + assert.SelectedLine(Contains("to remove")) + assert.SelectedLine(Contains("drop")) input.SwitchToFilesWindow() @@ -56,14 +56,14 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ input.PrimaryAction() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() - assert.MatchViewContent("information", NotContains("rebasing")) + assert.ViewContent("information", NotContains("rebasing")) // this proves we actually have integrated the changes from second-change-branch - assert.MatchViewContent("commits", Contains("second-change-branch unrelated change")) - assert.MatchViewContent("commits", Contains("to keep")) - assert.MatchViewContent("commits", NotContains("to remove")) + assert.ViewContent("commits", Contains("second-change-branch unrelated change")) + assert.ViewContent("commits", Contains("to keep")) + assert.ViewContent("commits", NotContains("to remove")) }, }) diff --git a/pkg/integration/tests/branch/reset.go b/pkg/integration/tests/branch/reset.go index 344c1b821..605b7e76c 100644 --- a/pkg/integration/tests/branch/reset.go +++ b/pkg/integration/tests/branch/reset.go @@ -24,19 +24,19 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("current-branch")) + assert.SelectedLine(Contains("current-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("other-branch")) + assert.SelectedLine(Contains("other-branch")) input.PressKeys(keys.Commits.ViewResetOptions) assert.InMenu() - assert.MatchCurrentViewTitle(Contains("reset to other-branch")) + assert.CurrentViewTitle(Contains("reset to other-branch")) - assert.MatchSelectedLine(Contains("soft reset")) + assert.SelectedLine(Contains("soft reset")) input.NextItem() - assert.MatchSelectedLine(Contains("mixed reset")) + assert.SelectedLine(Contains("mixed reset")) input.NextItem() - assert.MatchSelectedLine(Contains("hard reset")) + assert.SelectedLine(Contains("hard reset")) input.Confirm() @@ -47,8 +47,8 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") assert.CommitCount(2) - assert.MatchSelectedLine(Contains("other-branch commit")) + assert.SelectedLine(Contains("other-branch commit")) input.NextItem() - assert.MatchSelectedLine(Contains("root commit")) + assert.SelectedLine(Contains("root commit")) }, }) diff --git a/pkg/integration/tests/branch/suggestions.go b/pkg/integration/tests/branch/suggestions.go index 7f7f7e8cb..346c471d0 100644 --- a/pkg/integration/tests/branch/suggestions.go +++ b/pkg/integration/tests/branch/suggestions.go @@ -34,7 +34,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{ // we expect the first suggestion to be the branch we want because it most // closely matches what we typed in - assert.MatchSelectedLine(Contains("branch-to-checkout")) + assert.SelectedLine(Contains("branch-to-checkout")) input.Confirm() assert.CurrentBranchName("branch-to-checkout") diff --git a/pkg/integration/tests/cherry_pick/cherry_pick.go b/pkg/integration/tests/cherry_pick/cherry_pick.go index 0f5715434..7cbf6a70a 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick.go @@ -27,40 +27,40 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-branch")) + assert.SelectedLine(Contains("first-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-branch")) + assert.SelectedLine(Contains("second-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchSelectedLine(Contains("four")) + assert.SelectedLine(Contains("four")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("1 commit copied")) + assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() - assert.MatchSelectedLine(Contains("three")) + assert.SelectedLine(Contains("three")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("two")) + assert.SelectedLine(Contains("two")) input.PressKeys(keys.Commits.PasteCommits) assert.InAlert() - assert.MatchCurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) input.Confirm() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("four")) + assert.SelectedLine(Contains("four")) input.NextItem() - assert.MatchSelectedLine(Contains("three")) + assert.SelectedLine(Contains("three")) input.NextItem() - assert.MatchSelectedLine(Contains("two")) + assert.SelectedLine(Contains("two")) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.PressKeys(keys.Universal.Return) - assert.MatchViewContent("information", NotContains("commits copied")) + assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index e747d8e4d..99005ad8e 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -18,37 +18,37 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToBranchesWindow() assert.CurrentViewName("localBranches") - assert.MatchSelectedLine(Contains("first-change-branch")) + assert.SelectedLine(Contains("first-change-branch")) input.NextItem() - assert.MatchSelectedLine(Contains("second-change-branch")) + assert.SelectedLine(Contains("second-change-branch")) input.Enter() assert.CurrentViewName("subCommits") - assert.MatchSelectedLine(Contains("second-change-branch unrelated change")) + assert.SelectedLine(Contains("second-change-branch unrelated change")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("1 commit copied")) + assert.ViewContent("information", Contains("1 commit copied")) input.NextItem() - assert.MatchSelectedLine(Contains("second change")) + assert.SelectedLine(Contains("second change")) input.PressKeys(keys.Commits.CherryPickCopy) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("first change")) + assert.SelectedLine(Contains("first change")) input.PressKeys(keys.Commits.PasteCommits) assert.InAlert() - assert.MatchCurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) + assert.CurrentViewContent(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")) input.Confirm() - assert.MatchCurrentViewContent(Contains("Conflicts!")) + assert.CurrentViewContent(Contains("Conflicts!")) input.Confirm() assert.CurrentViewName("files") - assert.MatchSelectedLine(Contains("file")) + assert.SelectedLine(Contains("file")) // not using Confirm() convenience method because I suspect we might change this // keybinding to something more bespoke @@ -60,7 +60,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.PrimaryAction() assert.InConfirm() - assert.MatchCurrentViewContent(Contains("all merge conflicts resolved. Continue?")) + assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?")) input.Confirm() assert.CurrentViewName("files") @@ -69,19 +69,19 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ input.SwitchToCommitsWindow() assert.CurrentViewName("commits") - assert.MatchSelectedLine(Contains("second-change-branch unrelated change")) + assert.SelectedLine(Contains("second-change-branch unrelated change")) input.NextItem() - assert.MatchSelectedLine(Contains("second change")) + assert.SelectedLine(Contains("second change")) // because we picked 'Second change' when resolving the conflict, // we now see this commit as having replaced First Change with Second Change, // as opposed to replacing 'Original' with 'Second change' - assert.MatchMainViewContent(Contains("-First Change")) - assert.MatchMainViewContent(Contains("+Second Change")) + assert.MainViewContent(Contains("-First Change")) + assert.MainViewContent(Contains("+Second Change")) input.NextItem() - assert.MatchSelectedLine(Contains("first change")) + assert.SelectedLine(Contains("first change")) - assert.MatchViewContent("information", Contains("2 commits copied")) + assert.ViewContent("information", Contains("2 commits copied")) input.PressKeys(keys.Universal.Return) - assert.MatchViewContent("information", NotContains("commits copied")) + assert.ViewContent("information", NotContains("commits copied")) }, }) diff --git a/pkg/integration/tests/commit/commit.go b/pkg/integration/tests/commit/commit.go index dbef083ae..1b7c42793 100644 --- a/pkg/integration/tests/commit/commit.go +++ b/pkg/integration/tests/commit/commit.go @@ -27,6 +27,6 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals(commitMessage)) + assert.HeadCommitMessage(Equals(commitMessage)) }, }) diff --git a/pkg/integration/tests/commit/commit_multiline.go b/pkg/integration/tests/commit/commit_multiline.go index f6472dd33..15f26d15d 100644 --- a/pkg/integration/tests/commit/commit_multiline.go +++ b/pkg/integration/tests/commit/commit_multiline.go @@ -26,9 +26,9 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.CommitCount(1) - assert.MatchHeadCommitMessage(Equals("first line")) + assert.HeadCommitMessage(Equals("first line")) input.SwitchToCommitsWindow() - assert.MatchMainViewContent(MatchesRegexp("first line\n\\s*\n\\s*third line")) + assert.MainViewContent(MatchesRegexp("first line\n\\s*\n\\s*third line")) }, }) |