MCPcopy Index your code
hub / github.com/cli/cli / TestHuhPrompterInputHostname

Function TestHuhPrompterInputHostname

internal/prompter/huh_prompter_test.go:603–629  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

601}
602
603func TestHuhPrompterInputHostname(t *testing.T) {
604 tests := []struct {
605 name string
606 ix interaction
607 wantResult string
608 }{
609 {
610 name: "accepts valid hostname",
611 ix: newInteraction(typeKeys("github.example.com"), enter()),
612 wantResult: "github.example.com",
613 },
614 {
615 name: "rejects blank then accepts valid hostname",
616 ix: newInteraction(enter(), typeKeys("github.example.com"), enter()),
617 wantResult: "github.example.com",
618 },
619 }
620
621 for _, tt := range tests {
622 t.Run(tt.name, func(t *testing.T) {
623 p := newTestHuhPrompter()
624 f, result := p.buildInputHostnameForm()
625 runForm(t, f, tt.ix)
626 require.Equal(t, tt.wantResult, *result)
627 })
628 }
629}
630
631func TestHuhPrompterMultiSelectWithSearchBackspace(t *testing.T) {
632 // Simulate real API latency and non-overlapping results.

Callers

nothing calls this directly

Calls 8

newInteractionFunction · 0.85
typeKeysFunction · 0.85
enterFunction · 0.85
newTestHuhPrompterFunction · 0.85
runFormFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected