(t *testing.T)
| 501 | } |
| 502 | |
| 503 | func 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 | |
| 531 | func TestHuhPrompterConfirmDeletion(t *testing.T) { |
| 532 | tests := []struct { |
nothing calls this directly
no test coverage detected