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

Function TestHuhPrompterAuthToken

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

Source from the content-addressed store, hash-verified

501}
502
503func TestHuhPrompterAuthToken(t *testing.T) {
504 tests := []struct {
505 name string
506 ix interaction
507 wantResult string
508 }{
509 {
510 name: "accepts token input",
511 ix: newInteraction(typeKeys("ghp_abc123"), enter()),
512 wantResult: "ghp_abc123",
513 },
514 {
515 name: "rejects blank then accepts valid input",
516 ix: newInteraction(enter(), typeKeys("ghp_valid"), enter()),
517 wantResult: "ghp_valid",
518 },
519 }
520
521 for _, tt := range tests {
522 t.Run(tt.name, func(t *testing.T) {
523 p := newTestHuhPrompter()
524 f, result := p.buildAuthTokenForm()
525 runForm(t, f, tt.ix)
526 require.Equal(t, tt.wantResult, *result)
527 })
528 }
529}
530
531func TestHuhPrompterConfirmDeletion(t *testing.T) {
532 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