Tasks score notes (#8507)

* Added setting and modal for score notes

* Added persistent score notes

* Fixed linting issues and documented new field

* Added max length to task score notes

* Added check for score notes existence

* Combined tasks perferences
This commit is contained in:
Keith Holliday
2017-02-27 14:56:34 -07:00
committed by GitHub
parent 68a042cdb9
commit 93befcebcc
12 changed files with 102 additions and 9 deletions

View File

@@ -315,6 +315,30 @@ describe('POST /tasks/:id/score/:direction', () => {
expect(updatedUser.stats.gp).to.be.greaterThan(user.stats.gp);
});
it('adds score notes to task', async () => {
let scoreNotesString = 'test-notes';
await user.post(`/tasks/${habit._id}/score/up`, {
scoreNotes: scoreNotesString,
});
let updatedTask = await user.get(`/tasks/${habit._id}`);
expect(updatedTask.history[0].scoreNotes).to.eql(scoreNotesString);
});
it('errors when score notes are too large', async () => {
let scoreNotesString = new Array(258).join('a');
await expect(user.post(`/tasks/${habit._id}/score/up`, {
scoreNotes: scoreNotesString,
}))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('taskScoreNotesTooLong'),
});
});
});
context('reward', () => {