/
Pusher_ctor_test.go
51 lines (40 loc) · 1.33 KB
/
Pusher_ctor_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
package gopusher
import (
"github.com/pjvds/pusher-go-server/serialization"
"testing"
)
func TestCreatePusherInitializesAppId(t *testing.T) {
theAppId := "theappid"
result := CreatePusher(theAppId, aAppKey, aAppSecret, aPoster, aMarshaller)
if result.appId != theAppId {
t.Error("appId not initialized correctly")
}
}
func TestCreatePusherInitializesAppKey(t *testing.T) {
theAppKey := "theappkey"
result := CreatePusher(aAppId, theAppKey, aAppSecret, aPoster, aMarshaller)
if result.appKey != theAppKey {
t.Error("appKey not initialized correctly")
}
}
func TestCreatePusherInitializesAppSecret(t *testing.T) {
theAppSecret := "theappsecret"
result := CreatePusher(aAppId, aAppKey, theAppSecret, aPoster, aMarshaller)
if result.appSecret != theAppSecret {
t.Error("appSecret not initialized correctly")
}
}
func TestCreatePusherInitializesPoster(t *testing.T) {
thePoster := Poster(nil)
result := CreatePusher(aAppId, aAppKey, aAppSecret, thePoster, aMarshaller)
if result.poster != thePoster {
t.Error("poster not initialized correctly")
}
}
func TestCreatePusherInitializesMarshaller(t *testing.T) {
theMarshaller := serialization.NewJsonMarshaller()
result := CreatePusher(aAppId, aAppKey, aAppSecret, aPoster, theMarshaller)
if result.marshaller != theMarshaller {
t.Error("marshaller not initialized correctly")
}
}