mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-23 23:39:02 +01: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)
|
||||
|
||||
// Test running an AI query
|
||||
out := captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"?myQuery",
|
||||
tester.RunInteractiveShell(t, `hishtory config-set beta-mode true`)
|
||||
out := captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{
|
||||
{Keys: "hishtory SPACE tquery ENTER"},
|
||||
// ExtraDelay since AI queries are debounced and thus slower
|
||||
{Keys: "'?myQuery'", ExtraDelay: 1.0},
|
||||
})
|
||||
out = stripTuiCommandPrefix(t, out)
|
||||
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)
|
||||
for _, cmd := range captureConfig.complexCommands {
|
||||
if cmd.Keys != "" {
|
||||
fullCommand += " tmux send -t foo -- '"
|
||||
fullCommand += " tmux send -t foo -- "
|
||||
fullCommand += cmd.Keys
|
||||
fullCommand += "'\n"
|
||||
fullCommand += "\n"
|
||||
}
|
||||
if cmd.ResizeX != 0 && cmd.ResizeY != 0 {
|
||||
fullCommand += fmt.Sprintf(" tmux resize-window -t foo -x %d -y %d\n", cmd.ResizeX, cmd.ResizeY)
|
||||
|
Loading…
Reference in New Issue
Block a user