Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var msgCallback = function(message) {
if( message && message['new'] && message['new'].length > 0) {
messages += 1;
}
if( messages == N_MESSAGES ) {
done();
}
};
var httpCallback = function(error, response, body) {
if(error) done(error);
if(response.statusCode !== 201) done(body);
};
Promise.all([
testUser1.subscribe(msgCallback),
testUser2.subscribe(msgCallback),
testUser3.subscribe(msgCallback)
]).then(function() {
testUser1.addActivity(activity, httpCallback);
testUser2.addActivity(activity, httpCallback);
testUser3.addActivity(activity, httpCallback);
}, done);
});