Improves tests, ensure unicity of roleIds

This commit is contained in:
Florent Vilmart
2016-03-04 19:40:22 -05:00
parent c9f8453171
commit 17bc79b372
2 changed files with 20 additions and 18 deletions

View File

@@ -173,14 +173,9 @@ Auth.prototype._getAllRoleNamesForId = function(roleID) {
}).then(function(results){
// Flatten
let roleIDs = results.reduce( (memo, result) => {
if (typeof result == "object") {
memo = memo.concat(result);
} else {
memo.push(result);
}
return memo;
return memo.concat(result);
}, []);
return Promise.resolve(roleIDs);
return Promise.resolve([...new Set(roleIDs)]);
});
};