(t *testing.T)
| 324 | } |
| 325 | |
| 326 | func TestHuhPrompterPassword(t *testing.T) { |
| 327 | tests := []struct { |
| 328 | name string |
| 329 | ix interaction |
| 330 | wantResult string |
| 331 | }{ |
| 332 | { |
| 333 | name: "basic password", |
| 334 | ix: newInteraction(typeKeys("s3cret"), enter()), |
| 335 | wantResult: "s3cret", |
| 336 | }, |
| 337 | { |
| 338 | name: "empty password", |
| 339 | ix: newInteraction(enter()), |
| 340 | wantResult: "", |
| 341 | }, |
| 342 | } |
| 343 | |
| 344 | for _, tt := range tests { |
| 345 | t.Run(tt.name, func(t *testing.T) { |
| 346 | p := newTestHuhPrompter() |
| 347 | f, result := p.buildPasswordForm("Password:") |
| 348 | runForm(t, f, tt.ix) |
| 349 | require.Equal(t, tt.wantResult, *result) |
| 350 | }) |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | func TestHuhPrompterMarkdownEditor(t *testing.T) { |
| 355 | tests := []struct { |
nothing calls this directly
no test coverage detected