MCPcopy
hub / github.com/cli/cli / TestHuhPrompterInputHostname

Function TestHuhPrompterInputHostname

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

Source from the content-addressed store, hash-verified

556}
557
558func TestHuhPrompterInputHostname(t *testing.T) {
559 tests := []struct {
560 name string
561 ix interaction
562 wantResult string
563 }{
564 {
565 name: "accepts valid hostname",
566 ix: newInteraction(typeKeys("github.example.com"), enter()),
567 wantResult: "github.example.com",
568 },
569 {
570 name: "rejects blank then accepts valid hostname",
571 ix: newInteraction(enter(), typeKeys("github.example.com"), enter()),
572 wantResult: "github.example.com",
573 },
574 }
575
576 for _, tt := range tests {
577 t.Run(tt.name, func(t *testing.T) {
578 p := newTestHuhPrompter()
579 f, result := p.buildInputHostnameForm()
580 runForm(t, f, tt.ix)
581 require.Equal(t, tt.wantResult, *result)
582 })
583 }
584}
585
586func TestHuhPrompterMultiSelectWithSearchBackspace(t *testing.T) {
587 // 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