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

Function TestHuhPrompterAuthToken

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

Source from the content-addressed store, hash-verified

546}
547
548func TestHuhPrompterAuthToken(t *testing.T) {
549 tests := []struct {
550 name string
551 ix interaction
552 wantResult string
553 }{
554 {
555 name: "accepts token input",
556 ix: newInteraction(typeKeys("ghp_abc123"), enter()),
557 wantResult: "ghp_abc123",
558 },
559 {
560 name: "rejects blank then accepts valid input",
561 ix: newInteraction(enter(), typeKeys("ghp_valid"), enter()),
562 wantResult: "ghp_valid",
563 },
564 }
565
566 for _, tt := range tests {
567 t.Run(tt.name, func(t *testing.T) {
568 p := newTestHuhPrompter()
569 f, result := p.buildAuthTokenForm()
570 runForm(t, f, tt.ix)
571 require.Equal(t, tt.wantResult, *result)
572 })
573 }
574}
575
576func TestHuhPrompterConfirmDeletion(t *testing.T) {
577 tests := []struct {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected