(t *testing.T)
| 546 | } |
| 547 | |
| 548 | func 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 | |
| 576 | func TestHuhPrompterConfirmDeletion(t *testing.T) { |
| 577 | tests := []struct { |
nothing calls this directly
no test coverage detected