cleaner test assertions

This commit is contained in:
Jesse Duffield
2022-12-26 12:20:13 +11:00
parent fa0414777f
commit 9a6f21ce42
34 changed files with 442 additions and 378 deletions
@@ -24,9 +24,10 @@ var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
assert.CommitCount(1)
assert.MainViewContent(NotContains("error: Could not access"))
// we show baz because it's a modified file but we don't show bar because it's untracked
// (though it would be cool if we could show that too)
assert.MainViewContent(Contains("baz"))
assert.MainView().
Content(NotContains("error: Could not access")).
// we show baz because it's a modified file but we don't show bar because it's untracked
// (though it would be cool if we could show that too)
Content(Contains("baz"))
},
})
@@ -82,7 +82,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
discardOneByOne := func(files []statusFile) {
for _, file := range files {
assert.CurrentLine(Contains(file.status + " " + file.label))
assert.CurrentView().SelectedLine(Contains(file.status + " " + file.label))
input.Press(keys.Universal.Remove)
input.Menu(Equals(file.menuTitle), Contains("discard all changes"))
}
@@ -98,10 +98,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
{status: "DU", label: "deleted-us.txt", menuTitle: "deleted-us.txt"},
})
assert.InConfirm()
assert.CurrentViewTitle(Contains("continue"))
assert.CurrentViewContent(Contains("all merge conflicts resolved. Continue?"))
input.Press(keys.Universal.Return)
input.DenyConfirmation(Equals("continue"), Contains("all merge conflicts resolved. Continue?"))
discardOneByOne([]statusFile{
{status: "MD", label: "change-delete.txt", menuTitle: "change-delete.txt"},