-
Notifications
You must be signed in to change notification settings - Fork 0
/
validators_test.go
29 lines (27 loc) · 1014 Bytes
/
validators_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
package twiml
import "testing"
func Test_validSipURI(t *testing.T) {
type args struct {
v interface{}
param string
}
tests := []struct {
name string
args args
wantErr bool
}{
{name: "Valid SIPS URI", args: args{v: "sips:[email protected]:5061", param: ""}, wantErr: false},
{name: "Valid SIP URI", args: args{v: "sip:[email protected]:5061", param: ""}, wantErr: false},
{name: "Valid", args: args{v: "", param: "allowempty"}, wantErr: false},
{name: "Invaid", args: args{v: "", param: ""}, wantErr: true},
{name: "Invalid SIP URI", args: args{v: "+18002368945", param: ""}, wantErr: true},
{name: "Invalid URL", args: args{v: "https://[email protected]:5061", param: ""}, wantErr: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := validSipURI(tt.args.v, tt.args.param); (err != nil) != tt.wantErr {
t.Errorf("validSipURI() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}