(t *testing.T)
| 601 | } |
| 602 | |
| 603 | func 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 | |
| 631 | func TestHuhPrompterMultiSelectWithSearchBackspace(t *testing.T) { |
| 632 | // Simulate real API latency and non-overlapping results. |
nothing calls this directly
no test coverage detected