(t *testing.T)
| 394 | } |
| 395 | |
| 396 | func TestHuhPrompterMarkdownEditor(t *testing.T) { |
| 397 | tests := []struct { |
| 398 | name string |
| 399 | blankAllowed bool |
| 400 | ix interaction |
| 401 | wantResult string |
| 402 | }{ |
| 403 | { |
| 404 | name: "selects launch by default", |
| 405 | blankAllowed: true, |
| 406 | ix: newInteraction(enter()), |
| 407 | wantResult: "launch", |
| 408 | }, |
| 409 | { |
| 410 | name: "navigate to skip", |
| 411 | blankAllowed: true, |
| 412 | ix: newInteraction(down(), enter()), |
| 413 | wantResult: "skip", |
| 414 | }, |
| 415 | } |
| 416 | |
| 417 | for _, tt := range tests { |
| 418 | t.Run(tt.name, func(t *testing.T) { |
| 419 | p := newTestHuhPrompter() |
| 420 | f, result := p.buildMarkdownEditorForm("Body:", tt.blankAllowed) |
| 421 | runForm(t, f, tt.ix) |
| 422 | require.Equal(t, tt.wantResult, *result) |
| 423 | }) |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func TestHuhPrompterMultiSelectWithSearch(t *testing.T) { |
| 428 | staticSearchFunc := func(query string) MultiSelectSearchResult { |
nothing calls this directly
no test coverage detected