-
Notifications
You must be signed in to change notification settings - Fork 0
/
bark_test.go
126 lines (99 loc) · 1.71 KB
/
bark_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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package bark
import (
"github.com/joho/godotenv"
"log"
"os"
"testing"
)
var req = Req{
Debug: true,
}
func before() {
var err = godotenv.Load()
if err != nil {
log.Fatal(err)
}
req.DeviceKey = os.Getenv("DeviceKey")
}
func TestNotify(t *testing.T) {
before()
req.Title = "Notify"
req.Content = "TestNotify"
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestSound(t *testing.T) {
before()
req.Title = "Sound"
req.Content = "TestSound"
req.Sound = "paymentsuccess"
req.Call = true
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestIcon(t *testing.T) {
before()
req.Title = "Icon"
req.Content = "TestIcon"
req.Icon = "https://day.app/assets/images/avatar.jpg"
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestCritical(t *testing.T) {
before()
req.Title = "Critical"
req.Content = "TestCritical"
req.Critical = true
//*req.Volume = -100
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestLevel(t *testing.T) {
before()
req.Title = "Level"
req.Content = "TestLevel"
req.Level = "zxc"
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestURL(t *testing.T) {
before()
req.Title = "URL"
req.Content = "TestURL"
req.URL = "https://github.com/lkzc19/bark.sdk.go"
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestCopy(t *testing.T) {
before()
req.Title = "Copy"
req.Content = "TestCopy"
req.Copy = "https://pkg.go.dev/github.com/lkzc19/bark.sdk.go"
req.AutoCopy = true
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}
func TestBadge(t *testing.T) {
before()
req.Title = "Badge"
req.Content = "TestBadge"
req.Badge = 42
err := Notify(req)
if err != nil {
log.Fatal(err)
}
}