-
Notifications
You must be signed in to change notification settings - Fork 0
/
webhook_api_test.go
69 lines (66 loc) · 1.56 KB
/
webhook_api_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package fbmbotapi
import (
"encoding/json"
//"github.com/strongo/strongo-bots"
"testing"
//"github.com/strongo/bots-framework/core"
)
func TestTextMessage(t *testing.T) {
s := `{
"object":"page",
"entry":[
{
"id": "123456790",
"time":1457764198246,
"messaging":[
{
"sender":{
"id":"987654321"
},
"recipient":{
"id":"123456790"
},
"timestamp":1457764197627,
"message":{
"mid":"mid.1457764197618:41d102a3e1ae206a38",
"seq":73,
"text":"hello, world!"
}
}
]
}
]
}`
var receivedMessage ReceivedMessage
err := json.Unmarshal([]byte(s), &receivedMessage)
if err != nil {
t.Error(err)
return
}
if len(receivedMessage.Entries) != 1 {
t.Errorf("Invalid length of receivedMessage.Entry: %v, expected 1", len(receivedMessage.Entries))
}
}
//func TestEntryIsInterfaceOfWebhookEntry(t *testing.T) {
// _ = bots.WebhookEntry(Entry{})
//}
//
//func TestEntriesIsInterfaceOfArrayOfWebhookEntry(t *testing.T) {
// entries := []Entry{Entry{}}
// webhookEntries := []bots.WebhookEntry{}
// for _, entry := range entries {
// _ = append(webhookEntries, bots.WebhookEntry(entry))
// }
//}
//
//func TestSenderIsInterfaceOfWebhookSender(t *testing.T) {
// _ = bots.WebhookSender(Sender{})
//}
//
//func TestSenderIsInterfaceOfWebhookRecipient(t *testing.T) {
// _ = bots.WebhookRecipient(Recipient{})
//}
//
//func TestMessagingIsInterfaceOfWebhookInput(t *testing.T) {
// //_ = bots.webhookInput(Messaging{})
//}