mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 08:14:02 +01:00
Improve test to make the golden clearer about what is being tested
This commit is contained in:
parent
e5c038c8d6
commit
a58c426ad3
@ -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
|
||||
|
4
client/testdata/TestTui-InitialInvalidSearch
vendored
4
client/testdata/TestTui-InitialInvalidSearch
vendored
@ -1,7 +1,3 @@
|
||||
foo:
|
||||
|
||||
|
||||
|
||||
Search Query: > ls
|
||||
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user