Skip to content

Instantly share code, notes, and snippets.

@Sivli-Embir

Sivli-Embir/runner.js

Last active Aug 29, 2015
Embed
What would you like to do?
var pushConfiguration = null;
testRunner = function (notification, user) {
if(!pushConfiguration)
{
Push.debug = this.debug || false;
pushConfiguration = Push.Configure({
gcm: {
apiKey: this.gcm,
},
production: true, // use production server or sandbox
});
}
console.log("Herald-PushNotifications: sending notification",notification,user);
return true;
};
checkRunner = function (notification, user) {
console.log(notification);
if (notification && (!notification.data || !notification.data.title))
throw new Error('Herald-PushNotifications : notification "title" field must be defined');
if(!(this.gcm || this.apn))
throw new Error('Herald-PushNotifications : atleast "apn" or "gcm" fields must be defined',this);
};
var courier = {
gcm: '***************',
debug:true
};
var notification = {
data: {
from: 'xxxx',
title: 'xxxxxxxx',
text: '',
payload:{type:"approved",msgcnt:1}
}
};
runTestRunner = function () {
for (var i = 10 - 1; i >= 0; i--) {
checkRunner.call(courier, notification, Meteor.user());
testRunner.call(courier, notification, Meteor.user());
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment