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

@@ -38,7 +38,7 @@ function create(req, res, next) {
function get(req, res, next) {
assert.strictEqual(typeof req.params.groupId, 'string');
groups.get(req.params.groupId, function (error, result) {
groups.getWithMembers(req.params.groupId, function (error, result) {
if (error && error.reason === GroupError.NOT_FOUND) return next(new HttpError(404, 'No such group'));
if (error) return next(new HttpError(500, error));
@@ -47,8 +47,9 @@ function get(req, res, next) {
}
function list(req, res, next) {
groups.list(function (error, result) {
groups.getAll(function (error, result) {
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, { groups: result }));
});
}