-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvtwilio_test.go
62 lines (57 loc) · 1.49 KB
/
vtwilio_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 vtwilio
import "testing"
import "github.com/stretchr/testify/assert"
type in struct {
accountSID string
authToken string
opts []Option
number string
}
func TestVTwilio(t *testing.T) {
tests := []struct {
name string
in in
expected *VTwilio
}{
{
name: "empty vtwilio options",
in: in{accountSID: "sid", authToken: "token", opts: []Option{}},
expected: &VTwilio{accountSID: "sid", authToken: "token", twilioNumber: "", baseAPI: baseAPI},
},
{
name: "set number",
in: in{accountSID: "sid", authToken: "token", opts: []Option{TwilioNumber("12345678910")}},
expected: &VTwilio{accountSID: "sid", authToken: "token", twilioNumber: "12345678910", baseAPI: baseAPI},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
actual := NewVTwilio(tt.in.accountSID, tt.in.authToken, tt.in.opts...)
assert.Equal(t, tt.expected, actual)
})
}
}
func TestSetPhoneNumber(t *testing.T) {
tests := []struct {
name string
in in
expected *VTwilio
}{
{
name: "empty vtwilio options",
in: in{accountSID: "sid", authToken: "token", number: "12345678910"},
expected: &VTwilio{
accountSID: "sid",
authToken: "token",
twilioNumber: "12345678910",
baseAPI: baseAPI,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
actual := NewVTwilio(tt.in.accountSID, tt.in.authToken).SetPhoneNumber(tt.in.number)
assert.Equal(t, tt.expected, actual)
})
}
}