-
Notifications
You must be signed in to change notification settings - Fork 9
/
internet_test.go
74 lines (64 loc) · 1.8 KB
/
internet_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
package faker_test
import (
"fmt"
"testing"
"github.com/pioz/faker"
"github.com/stretchr/testify/assert"
)
func ExampleUsername() {
faker.SetSeed(1700)
fmt.Println(faker.Username())
// Output: polychasium
}
func ExampleDomain() {
faker.SetSeed(1701)
fmt.Println(faker.Domain())
// Output: lorusso.name
}
func ExampleEmail() {
faker.SetSeed(1702)
fmt.Println(faker.Email())
// Output: [email protected]
}
func ExampleFreeEmail() {
faker.SetSeed(1703)
fmt.Println(faker.FreeEmail())
// Output: [email protected]
}
func ExampleSafeEmail() {
faker.SetSeed(1704)
fmt.Println(faker.SafeEmail())
// Output: [email protected]
}
func ExampleSlug() {
faker.SetSeed(1705)
fmt.Println(faker.Slug())
// Output: a-reliable-seal-s-bee-comes-with-it-the-thought-that-the-adventurous-giraffe-is-an-alligator
}
func ExampleURL() {
faker.SetSeed(1706)
fmt.Println(faker.URL())
// Output: https://www.mcmillon.info/this-could-be-or-perhaps-their-alligator-was-in-this-moment-an-eager-spider
}
func TestInternetBuild(t *testing.T) {
faker.SetSeed(1720)
s := &struct {
Field1 string `faker:"Username"`
Field2 string `faker:"Domain"`
Field3 string `faker:"Email"`
Field4 string `faker:"SafeEmail"`
Field5 string `faker:"FreeEmail"`
Field6 string `faker:"Slug"`
Field7 string `faker:"Url"`
}{}
err := faker.Build(&s)
assert.Nil(t, err)
t.Log(s)
assert.Equal(t, "tight", s.Field1)
assert.Equal(t, "extortionate.info", s.Field2)
assert.Equal(t, "[email protected]", s.Field3)
assert.Equal(t, "[email protected]", s.Field4)
assert.Equal(t, "[email protected]", s.Field5)
assert.Equal(t, "a-friendly-blackberry-is-an-eagle-of-the-mind", s.Field6)
assert.Equal(t, "https://www.condescendence.info/nowhere-is-it-disputed-that-their-blueberry-was-in-this-moment-a-plausible-plum", s.Field7)
}