-
Notifications
You must be signed in to change notification settings - Fork 0
/
core_internal_test.go
62 lines (48 loc) · 1.19 KB
/
core_internal_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
package mono
import (
"net/http"
"testing"
)
func TestCore_setDomain(t *testing.T) {
c := newCore(WithDomain("test.com"))
if c.domain != "test.com" {
t.Fatal("Expected domain to be test.com, actual: " + c.domain)
}
}
func TestCore_setClient(t *testing.T) {
hct := &httpclienttest{}
c := newCore(WithClient(hct))
if c.client != hct {
t.Fatal("expected client to be custom")
}
}
func TestCore_setUnmarshaller(t *testing.T) {
umhs := &unmtest{}
c := newCore(WithUnmarshaller(umhs))
if c.unmarshaller != umhs {
t.Fatal("expected unmarshaller to be custom")
}
}
func TestCore_setWebhookBufferSize(t *testing.T) {
c := newCore(WithWebhookBufferSize(150))
if c.whBufferSize != 150 {
t.Fatal("expected wh buffer size to be custom")
}
}
func TestCoreDefaults(t *testing.T) {
c := newCore()
if c.domain != DefaultDomain {
t.Error("expected default domain, got: " + c.domain)
}
_, ok := c.client.(*http.Client)
if !ok {
t.Error("expected client to be a http.Client as default")
}
umsh := unmarshaller{}
if c.unmarshaller != umsh {
t.Error("expected default unmarshaller, got else")
}
if c.whBufferSize != 100 {
t.Error("expected default wh buffer size, got else")
}
}