raise coverage for tasks api calls (#10029)

* - updates a group task - approval is required
- updates a group task with checklist

* add expect to test the new checklist length

* - moves tasks to a specified position out of length

* remove unused line

* website getter tasks tests

* re-add sanitizeUserChallengeTask

* change config.json.example variable to be a string not a boolean

* fix tests - pick the text / up/down props too

* fix test - remove changes on text/up/down - revert sanitize condition - revert sanitization props
This commit is contained in:
negue
2018-10-01 13:29:14 +02:00
committed by Matteo Pagliazzi
parent 90273362c4
commit 362ca73c94
6 changed files with 231 additions and 11 deletions

View File

@@ -169,9 +169,13 @@ TaskSchema.statics.findByIdOrAlias = async function findByIdOrAlias (identifier,
// Sanitize user tasks linked to a challenge
// See http://habitica.wikia.com/wiki/Challenges#Challenge_Participant.27s_Permissions for more info
TaskSchema.statics.sanitizeUserChallengeTask = function sanitizeUserChallengeTask (taskObj) {
let initialSanitization = this.sanitize(taskObj);
const initialSanitization = this.sanitize(taskObj);
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias', 'yesterDaily', 'counterDown', 'counterUp']);
return _.pick(initialSanitization, [
'streak', 'checklist', 'attribute', 'reminders',
'tags', 'notes', 'collapseChecklist',
'alias', 'yesterDaily', 'counterDown', 'counterUp',
]);
};
// Sanitize checklist objects (disallowing id)