forked from ClearBlade/JavaScript-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushSpec.js
More file actions
36 lines (35 loc) · 938 Bytes
/
PushSpec.js
File metadata and controls
36 lines (35 loc) · 938 Bytes
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
/*
* Tests for the push messaging components of the ClearBlade JavaScript SDK
*/
describe("ClearBlade Push messaging", function () {
it("sends a push message", function () {
var users = ['user1', 'user2', 'user3'],
payload = { // I have no idea what's supposed to go here
alert: 'hello'
},
appId = 'someIDSuppliedByApple',
callNum = ClearBlade.request.calls.count(),
expectedData = {
method: 'POST',
endpoint: 'api/v/1/push/fakeSystemKey',
URI: undefined,
body: {
cbids: ['user1', 'user2', 'user3'],
"apple-message": JSON.stringify({
aps: {
alert: 'hello'
}
}),
appid: 'someIDSuppliedByApple'
},
user: {
authToken: 'testUserToken'
}
};
cb.sendPush(users, payload, appId, function (err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.calls.argsFor(callNum)[0]).toEqual(expectedData);
});
});
});