1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00

Merge pull request #354 from ayusharma/issue-352

Notification for multiple endpoints
This commit is contained in:
Juan Picado @jotadeveloper 2017-12-15 07:42:02 +01:00 committed by GitHub
commit 6ea99e39c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

@ -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)));
}
}
};

@ -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);