-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
badge_test.go
63 lines (49 loc) · 1.44 KB
/
badge_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
package markdown
import (
"io"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestMarkdown_RedBadgef(t *testing.T) {
t.Parallel()
t.Run("success RedBadgef()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.RedBadgef("%s", "Hello")
want := []string{"![Badge](https://img.shields.io/badge/Hello-red)"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success YellowBadgef()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.YellowBadgef("%s", "Hello")
want := []string{"![Badge](https://img.shields.io/badge/Hello-yellow)"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success GreenBadgef()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.GreenBadgef("%s", "Hello")
want := []string{"![Badge](https://img.shields.io/badge/Hello-green)"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success BlueBadgef()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.BlueBadgef("%s", "Hello")
want := []string{"![Badge](https://img.shields.io/badge/Hello-blue)"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
}