mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-24 14:01:46 +02:00
Fix testTui/ai test and add golden file for it
This commit is contained in:
parent
e712d77f62
commit
a8f47cf340
@ -1932,9 +1932,11 @@ func testTui_ai(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Test running an AI query
|
// Test running an AI query
|
||||||
out := captureTerminalOutput(t, tester, []string{
|
tester.RunInteractiveShell(t, `hishtory config-set beta-mode true`)
|
||||||
"hishtory SPACE tquery ENTER",
|
out := captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{
|
||||||
"?myQuery",
|
{Keys: "hishtory SPACE tquery ENTER"},
|
||||||
|
// ExtraDelay since AI queries are debounced and thus slower
|
||||||
|
{Keys: "'?myQuery'", ExtraDelay: 1.0},
|
||||||
})
|
})
|
||||||
out = stripTuiCommandPrefix(t, out)
|
out = stripTuiCommandPrefix(t, out)
|
||||||
testutils.CompareGoldens(t, out, "TestTui-AiQuery")
|
testutils.CompareGoldens(t, out, "TestTui-AiQuery")
|
||||||
|
27
client/lib/goldens/TestTui-AiQuery
Normal file
27
client/lib/goldens/TestTui-AiQuery
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Search Query: > ?myQuery
|
||||||
|
|
||||||
|
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ Hostname CWD Timestamp Runtime Exit Code Command │
|
||||||
|
│────────────────────────────────────────────────────────────────────────────────────────────────────────│
|
||||||
|
│ OpenAI N/A N/A N/A 0 result 1 │
|
||||||
|
│ OpenAI N/A N/A N/A 0 result 2 │
|
||||||
|
│ OpenAI N/A N/A N/A 0 longer result 3 │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
│ │
|
||||||
|
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
|
hiSHtory: Search your shell history • ctrl+h help
|
@ -236,9 +236,9 @@ func captureTerminalOutputComplex(t testing.TB, captureConfig TmuxCaptureConfig)
|
|||||||
require.NotEmpty(t, captureConfig.complexCommands)
|
require.NotEmpty(t, captureConfig.complexCommands)
|
||||||
for _, cmd := range captureConfig.complexCommands {
|
for _, cmd := range captureConfig.complexCommands {
|
||||||
if cmd.Keys != "" {
|
if cmd.Keys != "" {
|
||||||
fullCommand += " tmux send -t foo -- '"
|
fullCommand += " tmux send -t foo -- "
|
||||||
fullCommand += cmd.Keys
|
fullCommand += cmd.Keys
|
||||||
fullCommand += "'\n"
|
fullCommand += "\n"
|
||||||
}
|
}
|
||||||
if cmd.ResizeX != 0 && cmd.ResizeY != 0 {
|
if cmd.ResizeX != 0 && cmd.ResizeY != 0 {
|
||||||
fullCommand += fmt.Sprintf(" tmux resize-window -t foo -x %d -y %d\n", cmd.ResizeX, cmd.ResizeY)
|
fullCommand += fmt.Sprintf(" tmux resize-window -t foo -x %d -y %d\n", cmd.ResizeX, cmd.ResizeY)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user