-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
alert_test.go
77 lines (59 loc) · 1.59 KB
/
alert_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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package markdown
import (
"io"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestMarkdownAlerts(t *testing.T) {
t.Parallel()
t.Run("success Notef()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.Notef("%s", "Hello")
want := []string{"> [!NOTE] \n> Hello"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success Warningf()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.Warningf("%s", "Hello")
want := []string{"> [!WARNING] \n> Hello"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success Tipf()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.Tipf("%s", "Hello")
want := []string{"> [!TIP] \n> Hello"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success Importantf()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.Importantf("%s", "Hello")
want := []string{"> [!IMPORTANT] \n> Hello"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
t.Run("success Cautionf()", func(t *testing.T) {
t.Parallel()
m := NewMarkdown(io.Discard)
m.Cautionf("%s", "Hello")
want := []string{"> [!CAUTION] \n> Hello"}
got := m.body
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
}