Add groups route tests

This commit is contained in:
Girish Ramakrishnan
2016-02-09 15:26:34 -08:00
parent e20b3f75e4
commit 82cf667f3b
4 changed files with 206 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ exports = module.exports = {
create: create,
remove: remove,
get: get,
getWithMembers: getWithMembers,
getAll: getAll,
getMembers: getMembers,
@@ -106,6 +107,18 @@ function get(id, callback) {
});
}
function getWithMembers(id, callback) {
assert.strictEqual(typeof id, 'string');
assert.strictEqual(typeof callback, 'function');
groupdb.getWithMembers(id, function (error, result) {
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new GroupError(GroupError.NOT_FOUND));
if (error) return callback(new GroupError(GroupError.INTERNAL_ERROR, error));
return callback(null, result);
});
}
function getAll(callback) {
assert.strictEqual(typeof callback, 'function');