github.com/456vv/valexa@v1.0.2-0.20200706152242-1fb922d71ce5/EchoResponse_test.go (about) 1 package valexa 2 3 import ( 4 "testing" 5 ) 6 7 func Test_EchoResponse_SetShouldEndSession(testingT *testing.T){ 8 er := &EchoResponse{} 9 er.SetEndSession(true) 10 if !er.Response.ShouldEndSession { 11 testingT.Fatal("err") 12 } 13 } 14 15 func Test_EchoResponse_OutputSpeech(testingT *testing.T){ 16 er := &EchoResponse{} 17 er.OutputSpeech("1234") 18 if er.Response.OutputSpeech.Text != "1234" { 19 testingT.Fatal("err") 20 } 21 } 22 23 func Test_EchoResponse_OutputSpeechSSML(testingT *testing.T){ 24 er := &EchoResponse{} 25 er.OutputSpeechSSML("1234") 26 if er.Response.OutputSpeech.Ssml != "1234" { 27 testingT.Fatal("err") 28 } 29 } 30 31 func Test_EchoResponse_SimpleCard(testingT *testing.T){ 32 er := &EchoResponse{} 33 er.SimpleCard("title","1234") 34 if er.Response.Card.Title != "title" || er.Response.Card.Content != "1234" { 35 testingT.Fatal("err") 36 } 37 } 38 39 func Test_EchoResponse_StandardCard(testingT *testing.T){ 40 er := &EchoResponse{} 41 er.StandardCard("title","1234", "https://y.x.z/1.jpg", "https://y.x.z/2.jpg") 42 if er.Response.Card.Title != "title" || 43 er.Response.Card.Text != "1234" || 44 er.Response.Card.Image.SmallImageURL != "https://y.x.z/1.jpg" || 45 er.Response.Card.Image.LargeImageURL != "https://y.x.z/2.jpg"{ 46 testingT.Fatal("err") 47 } 48 } 49 50 func Test_EchoResponse_LinkAccountCard(testingT *testing.T){ 51 er := &EchoResponse{} 52 er.LinkAccountCard() 53 if er.Response.Card.Type != "LinkAccount" { 54 testingT.Fatal("err") 55 } 56 } 57 58 func Test_EchoResponse_RepromptText(testingT *testing.T){ 59 er := &EchoResponse{} 60 er.RepromptText("1234") 61 if er.Response.Reprompt.OutputSpeech.Text != "1234" { 62 testingT.Fatal("err") 63 } 64 } 65 66 func Test_EchoResponse_RepromptSSML(testingT *testing.T){ 67 er := &EchoResponse{} 68 er.RepromptSSML("1234") 69 if er.Response.Reprompt.OutputSpeech.Ssml != "1234" { 70 testingT.Fatal("err") 71 } 72 } 73 74 func Test_EchoResponse_String(testingT *testing.T){ 75 er := &EchoResponse{} 76 testingT.Log(er.String()) 77 } 78 79 80