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

Commit

Permalink
Re-enable TestAsk (#354)
Browse files Browse the repository at this point in the history
* Re-enable `TestAsk` tests.

Have been disabled since #216.

Co-authored-by: Boris Od <[email protected]>

* TestAsk: ensure `vi` is used in Editor tests

Co-authored-by: Boris Od <[email protected]>
  • Loading branch information
cben and borod108 authored May 12, 2021
1 parent b70520c commit 60ad3ef
Showing 1 changed file with 12 additions and 5 deletions.
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

0 comments on commit 60ad3ef

Please sign in to comment.