Split the flaky testTui/search test into two tests to increase odds of it passing quickly

This commit is contained in:
David Dworken 2023-10-23 18:53:16 -07:00
parent 27eeb7d099
commit 352e483db5
No known key found for this signature in database

View File

@ -97,6 +97,7 @@ func TestParam(t *testing.T) {
t.Run("testControlR/offline/bash", func(t *testing.T) { testControlR(t, bashTester{}, "bash", Offline) })
t.Run("testControlR/fish", func(t *testing.T) { testControlR(t, bashTester{}, "fish", Online) })
t.Run("testTui/search", testTui_search)
t.Run("testTui/invalidSearch", testTui_invalidSearch)
t.Run("testTui/general", testTui_general)
t.Run("testTui/scroll", testTui_scroll)
t.Run("testTui/resize", testTui_resize)
@ -1810,6 +1811,19 @@ func testTui_search(t *testing.T) {
if diff := cmp.Diff(expected, out); diff != "" {
t.Fatalf("hishtory tquery selection mismatch (-expected +got):\n%s", diff)
}
}
func testTui_invalidSearch(t *testing.T) {
// Setup
defer testutils.BackupAndRestore(t)()
tester, _, _ := setupTestTui(t)
// Check hishtory export to confirm the right commands are in the initial set of history entries
out := tester.RunInteractiveShell(t, `hishtory export`)
expected := "ls ~/\necho 'aaaaaa bbbb'\n"
if diff := cmp.Diff(expected, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s", diff)
}
// Check the output when the initial search is invalid
out = captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{