forked from jaswdr/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone_test.go
50 lines (43 loc) · 1.26 KB
/
phone_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
package faker
import (
"strings"
"testing"
)
func TestAreaCode(t *testing.T) {
p := New().Phone()
Expect(t, true, len(p.AreaCode()) == 3)
}
func TestExchangeCode(t *testing.T) {
p := New().Phone()
Expect(t, true, len(p.ExchangeCode()) == 3)
}
func TestNumber(t *testing.T) {
a := New().Phone()
number := a.Number()
Expect(t, true, len(number) > 0)
Expect(t, false, strings.Contains(number, "{{areaCode}}"))
Expect(t, false, strings.Contains(number, "{{exchangeCode}}"))
Expect(t, false, strings.Contains(number, "#"))
Expect(t, false, strings.Contains(number, "{{"))
Expect(t, false, strings.Contains(number, "}}"))
}
func TestTollFreeAreaCode(t *testing.T) {
a := New().Phone()
code := a.TollFreeAreaCode()
Expect(t, true, len(code) > 0)
}
func TestTollFreeNumber(t *testing.T) {
a := New().Phone()
number := a.ToolFreeNumber()
Expect(t, true, len(number) > 0)
Expect(t, false, strings.Contains(number, "{{tollFreeAreaCode}}"))
Expect(t, false, strings.Contains(number, "{{exchangeCode}}"))
Expect(t, false, strings.Contains(number, "#"))
Expect(t, false, strings.Contains(number, "{{"))
Expect(t, false, strings.Contains(number, "}}"))
}
func TestE164Number(t *testing.T) {
a := New().Phone()
number := a.E164Number()
Expect(t, true, len(number) > 0)
}