tests for tags

This commit is contained in:
Matteo Pagliazzi
2015-12-14 21:56:09 +01:00
parent 155719996d
commit 9864b8a1cb
2 changed files with 4 additions and 3 deletions

View File

@@ -277,6 +277,7 @@ function _updateDocument (collectionName, doc, update, cb) {
return cb();
}
// TODO use config for db url?
mongo.connect('mongodb://localhost/habitrpg_test', (connectErr, db) => {
if (connectErr) throw new Error(`Error connecting to database when updating ${collectionName} collection: ${connectErr}`);

View File

@@ -69,7 +69,7 @@ api.getTag = {
handler (req, res, next) {
let user = res.locals.user;
req.checkParams('taskId', res.t('tagIdRequired')).notEmpty().isUUID();
req.checkParams('tagId', res.t('tagIdRequired')).notEmpty().isUUID();
let validationErrors = req.validationErrors();
if (validationErrors) return next(validationErrors);
@@ -100,7 +100,7 @@ api.updateTag = {
req.checkParams('tagId', res.t('tagIdRequired')).notEmpty().isUUID();
// TODO check that req.body isn't empty
let tagId = req.params.id;
let tagId = req.params.tagId;
let validationErrors = req.validationErrors();
if (validationErrors) return next(validationErrors);
@@ -127,7 +127,7 @@ api.updateTag = {
* @apiSuccess {object} empty An empty object
*/
api.deleteTag = {
method: 'GET',
method: 'DELETE',
url: '/tags/:tagId',
middlewares: [authWithHeaders()],
handler (req, res, next) {