-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
payment_test.go
43 lines (35 loc) · 920 Bytes
/
payment_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
package faker
import (
"reflect"
"strings"
"testing"
)
func TestCreditCardType(t *testing.T) {
ccType, err := GetPayment().CreditCardType(reflect.Value{})
if err != nil {
t.Error("Expected not error, got err", err)
}
randCC := strings.ToLower(ccType.(string))
if _, exist := creditCards[randCC]; !exist {
t.Errorf("Expected from function creditCardType() : %s", randCC)
}
}
func TestCreditCardNumber(t *testing.T) {
_, err := GetPayment().CreditCardNumber(reflect.Value{})
if err != nil {
t.Error("Expected not error, got err", err)
}
}
func TestFakeCreditCardType(t *testing.T) {
ccType := CCType()
randCC := strings.ToLower(ccType)
if _, exist := creditCards[randCC]; !exist {
t.Errorf("Expected from function creditCardType() : %s", randCC)
}
}
func TestFakeCreditCardNumber(t *testing.T) {
ccNumber := CCNumber()
if ccNumber == "" {
t.Error("Expected Credit Card Number ")
}
}