forked from Pallinder/go-randomdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullprofile_test.go
49 lines (36 loc) · 1.08 KB
/
fullprofile_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
package randomdata
import (
"testing"
)
func Test_FullProfileGenerator(t *testing.T) {
profile := GenerateProfile(1)
if profile.Gender != "female" {
t.Fatalf("Expected gender to be female but got %s", profile.Gender)
}
profile = GenerateProfile(0)
if profile.Gender != "male" {
t.Fatalf("Expected gender to be male but got %s", profile.Gender)
}
profile = GenerateProfile(2)
if profile == nil {
t.Fatal("Profile failed to generate")
}
if !CheckPhoneNumber(profile.Cell, t) {
t.Fatalf("Expected Cell# to be a valid phone number: %v", profile.Cell)
}
if !CheckPhoneNumber(profile.Phone, t) {
t.Fatalf("Expected Phone# to be a valid phone number: %v", profile.Phone)
}
if profile.Login.Username == "" {
t.Fatal("Profile Username failed to generate")
}
if profile.Location.Street == "" {
t.Fatal("Profile Street failed to generate")
}
if profile.ID.Name != "SSN" {
t.Fatalf("Profile ID Name to be SSN, but got %s\n", profile.ID.Name)
}
if profile.Picture.Large == "" {
t.Fatalf("Profile Picture Large to be set, but got %s\n", profile.Picture.Large)
}
}