v3: check that tasks are deleted when the user deletes the acocunt and misc fixes

This commit is contained in:
Matteo Pagliazzi
2016-04-04 17:16:36 +02:00
parent 1620614b3b
commit 68ff26e6d6
4 changed files with 30 additions and 5 deletions

View File

@@ -5,7 +5,12 @@ import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import { find } from 'lodash';
import {
find,
each,
map,
} from 'lodash';
import Q from 'q';
describe('DELETE /user', () => {
let user;
@@ -38,6 +43,24 @@ describe('DELETE /user', () => {
});
it('deletes the user', async () => {
// gets the user's tasks ids
let ids = [];
each(user.tasksOrder, (idsForOrder) => {
ids.push(...idsForOrder);
});
expect(ids.length).to.be.above(0); // make sure the user has some task to delete
await user.del('/user', {
password,
});
await Q.all(map(ids, id => {
return expect(checkExistence('tasks', id)).to.eventually.eql(false);
}));
});
it('delete the user\'s tasks', async () => {
await user.del('/user', {
password,
});