mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
tests for tags
This commit is contained in:
@@ -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}`);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user