MCPcopy
hub / github.com/ddworken/hishtory / testTui_delete

Function testTui_delete

client/integration_test.go:2024–2064  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2022}
2023
2024func 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
2066func testTui_search(t *testing.T, onlineStatus OnlineStatus) {
2067 // Setup

Callers

nothing calls this directly

Calls 9

BackupAndRestoreFunction · 0.92
MakeFakeHistoryEntryFunction · 0.92
CompareGoldensFunction · 0.92
setupTestTuiFunction · 0.85
stripTuiCommandPrefixFunction · 0.85
captureTerminalOutputFunction · 0.85

Tested by

no test coverage detected