-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathpush.test.js
57 lines (50 loc) · 1.58 KB
/
push.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
var configMaster = require('./config-master');
var should = require('should');
var async = require('async');
var Kaiseki = require('../lib/kaiseki');
var request = require('request');
var _ = require('underscore');
var parse = new Kaiseki(configMaster);
xdescribe('push', function() {
it('can broadcast a notification', function(done) {
async.parallel([
// Android
function(callback) {
var notification = {
channels: [''],
type: 'android',
data: {
alert: 'The next World Series has been announced'
}
};
parse.sendPushNotification(notification, function(err, res, body, success) {
success.should.be.true;
should.exist(body.result);
should.exist(res);
body.result.should.be.true;
callback(err);
});
},
// iOS. We're expecting that this will fail because we didn't set up Push certificates yet.
function(callback) {
var notification = {
channels: [''],
type: 'ios',
data: {
alert: 'The next World Series has been announced'
}
};
parse.sendPushNotification(notification, function(err, res, body, success) {
success.should.be.false;
body.error.should.eql('To push to ios devices, you must first configure a valid certificate.');
body.code.should.eql(115);
should.not.exist(body.data);
should.exist(res);
callback(err);
});
}
], function(err, results) {
done(err);
});
});
});