Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Re-enable TestAsk #354

Merged
merged 2 commits into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions survey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ func TestPagination_lastHalf(t *testing.T) {
}

func TestAsk(t *testing.T) {
t.Skip()
return
tests := []struct {
name string
questions []*Question
Expand All @@ -152,12 +150,14 @@ func TestAsk(t *testing.T) {
{
Name: "commit-message",
Prompt: &Editor{
Editor: "vi",
Message: "Edit git commit message",
},
},
{
Name: "commit-message-validated",
Prompt: &Editor{
Editor: "vi",
Message: "Edit git commit message",
},
Validate: func(v interface{}) error {
Expand All @@ -174,13 +174,15 @@ func TestAsk(t *testing.T) {
Message: "What is your name?",
},
},
/* TODO gets stuck
{
Name: "day",
Prompt: &MultiSelect{
Message: "What days do you prefer:",
Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
},
},
*/
{
Name: "password",
Prompt: &Password{
Expand Down Expand Up @@ -226,6 +228,7 @@ func TestAsk(t *testing.T) {
c.ExpectString("What is your name?")
c.SendLine("Johnny Appleseed")

/* TODO gets stuck
// MultiSelect
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Select Monday.
Expand All @@ -235,6 +238,7 @@ func TestAsk(t *testing.T) {
c.Send(string(terminal.KeyArrowDown))
c.Send(string(terminal.KeyArrowDown))
c.SendLine(" ")
*/

// Password
c.ExpectString("Please type your password")
Expand All @@ -250,10 +254,12 @@ func TestAsk(t *testing.T) {
"pizza": true,
"commit-message": "Add editor prompt tests\n",
"commit-message-validated": "Add editor prompt tests\n",
"name": "Johnny Appleseed",
"day": []string{"Monday", "Wednesday"},
"name": "Johnny Appleseed",
/* TODO
"day": []string{"Monday", "Wednesday"},
*/
"password": "secret",
"color": "yellow",
"color": core.OptionAnswer{Index: 3, Value: "yellow"},
},
},
{
Expand All @@ -271,6 +277,7 @@ func TestAsk(t *testing.T) {
c.ExpectString("What is your name?")
c.SendLine("")
c.ExpectString("Sorry, your reply was invalid: Value is required")
time.Sleep(time.Millisecond)
c.SendLine("Johnny Appleseed")
c.ExpectEOF()
},
Expand Down