-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
color_test.go
54 lines (41 loc) · 998 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
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) >= 5)
Expect(t, true, len(color) <= 11)
Expect(t, true, strings.Contains(color, ","))
}
func TestRGBAsArray(t *testing.T) {
c := New().Color()
Expect(t, 3, len(c.RGBAsArray()))
}
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)
}