forked from jaswdr/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
color_test.go
55 lines (42 loc) · 1013 Bytes
/
color_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
package faker
import (
"strings"
"testing"
)
func TestHex(t *testing.T) {
c := New().Color()
color := c.Hex()
Expect(t, 7, len(color))
Expect(t, true, strings.Contains(color, "#"))
}
func TestRGB(t *testing.T) {
c := New().Color()
color := c.RGB()
Expect(t, true, len(color) > 6)
Expect(t, true, len(color) <= 11)
Expect(t, true, strings.Contains(color, ","))
}
func TestRGBAsArray(t *testing.T) {
c := New().Color()
color := c.RGBAsArray()
Expect(t, 3, len(color))
}
func TestCSS(t *testing.T) {
c := New().Color()
color := c.CSS()
Expect(t, true, len(color) > 10)
Expect(t, true, len(color) <= 16)
Expect(t, true, strings.Contains(color, "rgb("))
Expect(t, true, strings.Contains(color, ","))
Expect(t, true, strings.Contains(color, ")"))
}
func TestSafeColorName(t *testing.T) {
c := New().Color()
color := c.SafeColorName()
Expect(t, true, len(color) > 0)
}
func TestColorName(t *testing.T) {
c := New().Color()
color := c.ColorName()
Expect(t, true, len(color) > 0)
}