forked from asticode/go-astilectron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification_test.go
30 lines (26 loc) · 1.17 KB
/
notification_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
package astilectron
import (
"testing"
"github.com/asticode/go-astitools/context"
)
func TestNotification_Actions(t *testing.T) {
// Init
var c = asticontext.NewCanceller()
var d = newDispatcher()
var i = newIdentifier()
var wrt = &mockedWriter{}
var w = newWriter(wrt)
var n = newNotification(&NotificationOptions{
Body: "body",
HasReply: PtrBool(true),
Icon: "/path/to/icon",
ReplyPlaceholder: "placeholder",
Silent: PtrBool(true),
Sound: "sound",
Subtitle: "subtitle",
Title: "title",
}, true, c, d, i, w)
// Actions
testObjectAction(t, func() error { return n.Create() }, n.object, wrt, "{\"name\":\""+eventNameNotificationCmdCreate+"\",\"targetID\":\""+n.id+"\",\"notificationOptions\":{\"body\":\"body\",\"hasReply\":true,\"icon\":\"/path/to/icon\",\"replyPlaceholder\":\"placeholder\",\"silent\":true,\"sound\":\"sound\",\"subtitle\":\"subtitle\",\"title\":\"title\"}}\n", EventNameNotificationEventCreated)
testObjectAction(t, func() error { return n.Show() }, n.object, wrt, "{\"name\":\""+eventNameNotificationCmdShow+"\",\"targetID\":\""+n.id+"\"}\n", EventNameNotificationEventShown)
}