Improve test to make the golden clearer about what is being tested

This commit is contained in:
David Dworken 2023-12-21 17:43:26 -08:00
parent e5c038c8d6
commit a58c426ad3
No known key found for this signature in database
3 changed files with 2 additions and 6 deletions

View File

@ -1858,7 +1858,7 @@ func testTui_search(t *testing.T, onlineStatus OnlineStatus) {
{Keys: "hishtory SPACE tquery SPACE foo: ENTER", ExtraDelay: 1.5},
{Keys: "ls", ExtraDelay: 1.0},
})
out = stripTuiCommandPrefix(t, out)
out = stripRequiredPrefix(t, out, "hishtory tquery foo:")
testutils.CompareGoldens(t, out, "TestTui-InitialInvalidSearch")
// Check the output when the search is invalid

View File

@ -1,7 +1,3 @@
foo:
Search Query: > ls
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐

View File

@ -361,8 +361,8 @@ func stripShellPrefix(out string) string {
func stripRequiredPrefix(t *testing.T, out, prefix string) string {
require.Contains(t, out, prefix)
return strings.TrimSpace(strings.Split(out, prefix)[1])
}
func stripTuiCommandPrefix(t *testing.T, out string) string {
return stripRequiredPrefix(t, out, "hishtory tquery")
}