-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
person_test.go
113 lines (95 loc) · 2.45 KB
/
person_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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package faker
import (
"fmt"
"strings"
"testing"
)
func TestTitleMale(t *testing.T) {
p := New().Person()
Expect(t, "Mr.", p.TitleMale())
}
func TestTitleFemale(t *testing.T) {
p := New().Person()
Expect(t, "Ms.", p.TitleFemale())
}
func TestTitle(t *testing.T) {
p := New().Person()
Expect(t, 3, len(p.Title()))
}
func TestSuffix(t *testing.T) {
p := New().Person()
suffix := p.Suffix()
Expect(t, true, len(suffix) > 0)
}
func TestFirstNameMale(t *testing.T) {
p := New().Person()
firstName := p.FirstNameMale()
Expect(t, true, len(firstName) > 0)
}
func TestFirstNameFemale(t *testing.T) {
p := New().Person()
firstName := p.FirstNameFemale()
Expect(t, true, len(firstName) > 0)
}
func TestFirstName(t *testing.T) {
p := New().Person()
firstName := p.FirstName()
Expect(t, true, len(firstName) > 0)
}
func TestLastName(t *testing.T) {
p := New().Person()
lastName := p.LastName()
Expect(t, true, len(lastName) > 0)
}
func TestName(t *testing.T) {
p := New().Person()
name := p.Name()
Expect(t, true, len(name) > 0)
Expect(t, false, strings.Contains(name, "{{titleMale}}"))
Expect(t, false, strings.Contains(name, "{{firstNameMale}}"))
Expect(t, false, strings.Contains(name, "{{titleFemale}}"))
Expect(t, false, strings.Contains(name, "{{firstNameFemale}}"))
Expect(t, false, strings.Contains(name, "{{lastName}}"))
Expect(t, false, strings.Contains(name, "{{suffix}}"))
}
func TestGender(t *testing.T) {
p := New().Person()
gender := p.Gender()
Expect(t, true, gender == "Male" || gender == "Female")
}
func TestGenderMale(t *testing.T) {
p := New().Person()
Expect(t, "Male", p.GenderMale())
}
func TestGenderFemale(t *testing.T) {
p := New().Person()
Expect(t, "Female", p.GenderFemale())
}
func TestNameAndGender(t *testing.T) {
p := New().Person()
name, gender := p.NameAndGender()
Expect(t, true, name != "")
Expect(t, true, gender == "Male" || gender == "Female")
}
func TestSSN(t *testing.T) {
p := New().Person()
ssn := p.SSN()
Expect(t, 9, len(ssn))
}
func TestContact(t *testing.T) {
p := New().Person()
contact := p.Contact()
Expect(t, true, len(contact.Phone) > 0)
Expect(t, true, len(contact.Email) > 0)
}
func TestPersonImage(t *testing.T) {
p := New().Person()
image := p.Image()
Expect(t, fmt.Sprintf("%T", image), "*os.File")
Expect(t, strings.HasSuffix(image.Name(), ".jpg"), true, image.Name())
}
func TestPersonaNameMale(t *testing.T) {
p := New().Person()
name := p.NameMale()
Expect(t, true, len(name) > 0)
}