0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-04-01 02:42:23 -05:00

fix: notification for multiple endpoints

add silent fail case for notification promise
This commit is contained in:
Ayush Sharma 2017-10-12 21:05:34 +05:30
parent 5b9f0c09ac
commit b605d1ed7e
2 changed files with 6 additions and 8 deletions

View file

@ -69,11 +69,7 @@ const notify = function(metadata, config) {
return handleNotify(metadata, config.notify);
} else {
// multiple notifications endpoints PR #108
for (const key in config.notify) {
if (config.notify.hasOwnProperty(key)) {
return handleNotify(metadata, config.notify[key]);
}
}
return Promise.all(_.map(config.notify, (key) => handleNotify(metadata, key)));
}
}
};

View file

@ -86,9 +86,11 @@ module.exports = function() {
}
notify(metadata, multipleNotificationsEndpoint).then(function (body) {
const jsonBody = JSON.parse(body);
assert.ok(`New package published: * ${metadata.name}*` === jsonBody.message,
'Body notify message should be equal');
body.forEach(function(notification) {
const jsonBody = JSON.parse(notification);
assert.ok(`New package published: * ${metadata.name}*` === jsonBody.message,
'Body notify message should be equal');
});
done();
}, function (err) {
assert.fail(err);