fix: address protocol probe review findings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
|
||||
"proxyctl/internal/app"
|
||||
"proxyctl/internal/probe"
|
||||
"proxyctl/internal/profile"
|
||||
)
|
||||
|
||||
@@ -304,10 +306,6 @@ func TestCompleteModelFooterHintsMatchContextAndAcceptedKeys(t *testing.T) {
|
||||
if probeCommand == nil || !strings.Contains(model.View(), "Protocol Probe in progress") || strings.Contains(model.View(), "Ctrl+D: probe") {
|
||||
t.Fatalf("probe footer did not follow accepted in-field action and progress:\n%s", model.View())
|
||||
}
|
||||
model = updateKey(model, "?")
|
||||
assertUsableFrame(t, model.View(), 80, 24, "Protocol Probe is in progress", "Ctrl+D does not start a duplicate probe")
|
||||
model = updateKey(model, "esc")
|
||||
|
||||
model = updateKey(model, "ctrl+t")
|
||||
if strings.Contains(model.View(), "Ctrl+D: probe") || !strings.Contains(model.View(), "advanced mode") {
|
||||
t.Fatalf("Advanced form advertised a Single-field Protocol Probe:\n%s", model.View())
|
||||
@@ -335,6 +333,37 @@ func TestCompleteModelFooterHintsMatchContextAndAcceptedKeys(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestCompleteModelHelpDocumentsProbeShortcutExplicitOnlyAttachmentAndDuplicateSuppression(t *testing.T) {
|
||||
model := openProtocolProbeEditor(t, &recordingModule{}, func(context.Context, string) (probe.Capabilities, error) {
|
||||
return probe.Capabilities{HTTP: true, SOCKS5: true}, nil
|
||||
}, "proxy.example:7890")
|
||||
|
||||
model = updateKey(model, "?")
|
||||
assertUsableFrame(t, model.View(), 80, 24,
|
||||
"Ctrl+D explicitly runs Protocol Probe for the focused Single proxy URL field.",
|
||||
"never runs on form entry, focus changes, or save.")
|
||||
model = updateKey(model, "esc")
|
||||
|
||||
model, command := startProtocolProbe(t, model)
|
||||
updated, duplicate := model.Update(tea.KeyMsg{Type: tea.KeyCtrlD})
|
||||
model = updated.(Model)
|
||||
if duplicate != nil {
|
||||
t.Fatal("repeated Probe shortcut emitted duplicate work")
|
||||
}
|
||||
model = updateKey(model, "?")
|
||||
assertUsableFrame(t, model.View(), 80, 24,
|
||||
"Protocol Probe is in progress for the Single proxy URL field.",
|
||||
"Ctrl+D does not start a duplicate probe")
|
||||
model = updateKey(model, "esc")
|
||||
|
||||
model = finishProtocolProbe(t, model, command)
|
||||
model = updateKey(model, "?")
|
||||
assertUsableFrame(t, model.View(), 80, 24,
|
||||
"The Protocol Probe result remains attached to its read-only initiating Single",
|
||||
"proxy URL context. The HTTP, HTTPS, and ALL/SOCKS values were generated from",
|
||||
"that probe.")
|
||||
}
|
||||
|
||||
func TestCompleteModelHelpOverEditorPreservesFieldCursorPreviewAndResizeState(t *testing.T) {
|
||||
module := &profileManagementModule{}
|
||||
model := openNewProfileEditor(t, module)
|
||||
|
||||
Reference in New Issue
Block a user