Handle error in NewWebhook and NewWebhookWithCert

This commit is contained in:
Wojciech Zagórski 2020-09-30 22:19:29 +02:00
parent 2f7211a708
commit 69a82708c4
3 changed files with 69 additions and 12 deletions

View file

@ -4,6 +4,31 @@ import (
"testing"
)
func TestNewWebhook(t *testing.T) {
result, err := NewWebhook("https://example.com/token")
if err != nil ||
result.URL.String() != "https://example.com/token" ||
result.Certificate != interface{}(nil) ||
result.MaxConnections != 0 ||
len(result.AllowedUpdates) != 0 {
t.Fail()
}
}
func TestNewWebhookWithCert(t *testing.T) {
exampleFile := File{FileID: "123"}
result, err := NewWebhookWithCert("https://example.com/token", exampleFile)
if err != nil ||
result.URL.String() != "https://example.com/token" ||
result.Certificate != exampleFile ||
result.MaxConnections != 0 ||
len(result.AllowedUpdates) != 0 {
t.Fail()
}
}
func TestNewInlineQueryResultArticle(t *testing.T) {
result := NewInlineQueryResultArticle("id", "title", "message")