-
Notifications
You must be signed in to change notification settings - Fork 37
/
company_test.go
43 lines (34 loc) · 895 Bytes
/
company_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 (
"fmt"
"regexp"
"testing"
)
func TestCompanyName(t *testing.T) {
testMatchRx(t, Company().Name, `[A-Z][a-z]+?`)
}
func TestCompanySuffix(t *testing.T) {
testMatchRx(t, Company().Suffix, `\w+?`)
}
func TestCompanyCatchPhrase(t *testing.T) {
testMatchRx(t, Company().CatchPhrase, `[A-z][a-z]+?`)
}
func TestCompanyBs(t *testing.T) {
testMatchRx(t, Company().Bs, `[A-z][a-z]+?`)
}
func TestCompanyEin(t *testing.T) {
testMatchRx(t, Company().Ein, `\d{2}-\d{7}`)
}
func TestCompanyDunsNumber(t *testing.T) {
testMatchRx(t, Company().DunsNumber, `\d{2}-\d{3}-\d{4}`)
}
func TestCompanyLogo(t *testing.T) {
testMatchRx(t, Company().Logo, `http://.+\d{3}.gif`)
}
func TestCompanyStringer(t *testing.T) {
rx := `[A-Z][a-z]+?`
res := fmt.Sprintf("%s", Company())
if m, _ := regexp.MatchString(rx, res); !m {
t.Errorf("expected %v to match %v", res, rx)
}
}