-
Notifications
You must be signed in to change notification settings - Fork 1
/
smsglobal_test.go
44 lines (36 loc) · 1.29 KB
/
smsglobal_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
package smsglobal
import (
"github.com/smsglobal/smsglobal-go/internal/pkg/otp"
"testing"
"github.com/stretchr/testify/assert"
"github.com/smsglobal/smsglobal-go/internal/pkg/sms"
"github.com/smsglobal/smsglobal-go/internal/pkg/sms-incoming"
"github.com/smsglobal/smsglobal-go/internal/pkg/user"
"github.com/smsglobal/smsglobal-go/internal/types/api"
)
func TestNew(t *testing.T) {
_, err := New("", "")
assert.Error(t, err)
s, _ := New("key", "secret")
assert.Equal(t, "key", s.User.Handler.Key)
assert.Equal(t, "secret", s.User.Handler.Secret)
assert.IsType(t, s.Sms, &sms.Client{})
assert.IsType(t, s.User, &user.Client{})
assert.IsType(t, s.SmsIncoming, &sms_incoming.Client{})
assert.IsType(t, s.Otp, &otp.Client{})
}
func TestCreateSms(t *testing.T) {
c, _ := New("ae311d825f75e8732b4c1a5680a11aa9", "c65fa91e71af7ccf11561e95758dd158")
s := c.CreateSms()
assert.IsType(t, s, &api.SendSingleSms{})
}
func TestCreateMultipleSms(t *testing.T) {
c, _ := New("ae311d825f75e8732b4c1a5680a11aa9", "c65fa91e71af7ccf11561e95758dd158")
s := c.CreateMultipleSms()
assert.IsType(t, s.Messages, []*api.SendSingleSms{})
}
func TestCreateOtp(t *testing.T) {
c, _ := New("ae311d825f75e8732b4c1a5680a11aa9", "c65fa91e71af7ccf11561e95758dd158")
o := c.CreateOtp()
assert.IsType(t, o, &api.SendOtp{})
}