-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
68 lines (66 loc) · 1.75 KB
/
test.js
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
var t = require('blue-tape');
var appboySdk = require('./app.js');
var groupId = "<your-groupId>";
var recipients = ["311e1e74-fce0-4d7f-b264-e2c2cd3210b1"];
var text = "This is a test notification";
var title = "This is the title";
var badge = 1;
var alert = "default";
var contentAvailable = true;
var deepLinks = {
"ios": "myapp://deeplink/openContent",
"android": "myapp://deeplink/openContent",
"kindle": "",
"web": "",
};
t.test("Basic fields entered", function(t) {
var config = {
groupId: groupId,
recipients: recipients,
text: text,
title: title,
deepLinks: deepLinks
}
return appboySdk.sendPush(config).then(function(res) {
t.equals(res.message, "success", "OK");
})
});
t.test("All fields entered", function(t) {
var config = {
groupId: groupId,
recipients: recipients,
text: text,
title: title,
badge: badge,
alert: alert,
deepLinks: deepLinks
}
return appboySdk.sendPush(config).then(function(res) {
t.equals(res.message, "success", "OK");
})
});
t.test("contentAvailable (silent push)", function(t) {
var config = {
groupId: groupId,
recipients: recipients,
text: text,
title: title,
contentAvailable: contentAvailable,
badge: badge,
deepLinks: deepLinks
}
return appboySdk.sendPush(config).then(function(res) {
t.equals(res.message, "success", "OK");
})
});
t.test("Missing fields", function(t) {
var config = {
groupId: groupId,
text: text,
title: title,
deepLinks: deepLinks
}
return appboySdk.sendPush(config).then(function(res) {
t.notEqual(res.message, "success", "OK");
})
});