-
Notifications
You must be signed in to change notification settings - Fork 0
/
option_test.go
87 lines (56 loc) · 1.4 KB
/
option_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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2022 Axel Etcheverry. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package amplitude
import (
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestWithURL(t *testing.T) {
c := &client{}
WithURL("https://api.amplitude.tld")(c)
assert.Equal(t, "https://api.amplitude.tld", c.endpoint)
}
func TestWithTimeout(t *testing.T) {
c := &client{}
WithTimeout(time.Second * 2)(c)
assert.Equal(t, time.Second*2, c.timeout)
}
func TestWithInterval(t *testing.T) {
c := &client{}
WithInterval(time.Second * 2)(c)
assert.Equal(t, time.Second*2, c.interval)
}
func TestWithBatchSize(t *testing.T) {
c := &client{}
WithBatchSize(2)(c)
assert.Equal(t, 2, c.batchSize)
}
func TestWithBufferSize(t *testing.T) {
c := &client{}
WithBufferSize(2)(c)
assert.Equal(t, 2, c.bufferSize)
}
func TestWithMaxRetry(t *testing.T) {
c := &client{}
WithMaxRetry(2)(c)
assert.Equal(t, 2, c.maxRetry)
}
func TestWithRetryInterval(t *testing.T) {
c := &client{}
WithRetryInterval(time.Second * 2)(c)
assert.Equal(t, time.Second*2, c.retryInterval)
}
func TestWithRetrySize(t *testing.T) {
c := &client{}
WithRetrySize(2)(c)
assert.Equal(t, 2, c.retrySize)
}
func TestWithHTTPClient(t *testing.T) {
c := &client{}
hc := &http.Client{}
WithHTTPClient(hc)(c)
assert.Equal(t, hc, c.httpClient)
}