(t *testing.T)
| 2022 | } |
| 2023 | |
| 2024 | func testTui_delete(t *testing.T) { |
| 2025 | // Setup |
| 2026 | defer testutils.BackupAndRestore(t)() |
| 2027 | tester, userSecret, _ := setupTestTui(t, Online) |
| 2028 | manuallySubmitHistoryEntry(t, userSecret, testutils.MakeFakeHistoryEntry("echo 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'")) |
| 2029 | |
| 2030 | // Check that we can delete an entry |
| 2031 | out := captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{ |
| 2032 | {Keys: "hishtory SPACE tquery ENTER"}, |
| 2033 | // ExtraDelay so that the search query finishes before we hit delete |
| 2034 | {Keys: "aaaaaa", ExtraDelay: 1.0}, |
| 2035 | {Keys: "C-K"}, |
| 2036 | }) |
| 2037 | out = stripTuiCommandPrefix(t, out) |
| 2038 | testutils.CompareGoldens(t, out, "TestTui-Delete") |
| 2039 | |
| 2040 | // And that it stays deleted |
| 2041 | out = captureTerminalOutput(t, tester, []string{ |
| 2042 | "hishtory SPACE tquery ENTER", |
| 2043 | }) |
| 2044 | out = stripTuiCommandPrefix(t, out) |
| 2045 | testutils.CompareGoldens(t, out, "TestTui-DeleteStill") |
| 2046 | |
| 2047 | // And that we can then delete another entry |
| 2048 | out = captureTerminalOutput(t, tester, []string{ |
| 2049 | "hishtory SPACE tquery ENTER", |
| 2050 | "C-K", |
| 2051 | }) |
| 2052 | out = stripTuiCommandPrefix(t, out) |
| 2053 | testutils.CompareGoldens(t, out, "TestTui-DeleteAgain") |
| 2054 | |
| 2055 | // And that it stays deleted |
| 2056 | out = captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{ |
| 2057 | {Keys: "hishtory SPACE tquery ENTER", ExtraDelay: 1.5}, |
| 2058 | }) |
| 2059 | out = stripTuiCommandPrefix(t, out) |
| 2060 | testutils.CompareGoldens(t, out, "TestTui-DeleteAgainStill") |
| 2061 | |
| 2062 | // Assert there are no leaked connections |
| 2063 | assertNoLeakedConnections(t) |
| 2064 | } |
| 2065 | |
| 2066 | func testTui_search(t *testing.T, onlineStatus OnlineStatus) { |
| 2067 | // Setup |
nothing calls this directly
no test coverage detected