-
Notifications
You must be signed in to change notification settings - Fork 1
/
stk_test.go
61 lines (55 loc) · 1007 Bytes
/
stk_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
package mpesa_go
import "testing"
func Test_CheckKenyaInternationalPhoneNumber(t *testing.T) {
type args struct {
phone string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "test correct phone",
args: args{
phone: "254798675644",
},
want: true,
},
{
name: "test More numbers",
args: args{
phone: "+2547986756445",
},
want: false,
},
{
name: "test 9 character phone",
args: args{
phone: "25479867564",
},
want: false,
},
{
name: "test 07 phone",
args: args{
phone: "0798675644",
},
want: false,
},
{
name: "With Plus international phone",
args: args{
phone: "+25479867564",
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CheckKenyaInternationalPhoneNumber(tt.args.phone); got != tt.want {
t.Errorf("%s In checkKenyaInternationalPhoneNumber(%v) = %v, want %v", tt.name, tt.args.phone, got, tt.want)
}
})
}
}