adapt current tests and change urls to avoid conflicts

This commit is contained in:
Matteo Pagliazzi
2016-01-04 22:03:21 +01:00
parent 6680853078
commit 3bc8945bcc
14 changed files with 105 additions and 94 deletions

View File

@@ -16,14 +16,14 @@ describe('GET /tasks', () => {
});
it('returns all user\'s tasks', async () => {
let createdTasks = await user.post('/tasks', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
let tasks = await user.get('/tasks/user');
let createdTasks = await user.post('/tasks?tasksOwner=user', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
let tasks = await user.get('/tasks?tasksOwner=user');
expect(tasks.length).to.equal(createdTasks.length + 1); // + 1 because 1 is a default task
});
it('returns only a type of user\'s tasks if req.query.type is specified', async () => {
let createdTasks = await user.post('/tasks', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
let tasks = await user.get('/tasks/user?type=habit');
let createdTasks = await user.post('/tasks?tasksOwner=user', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
let tasks = await user.get('/tasks?tasksOwner=user&type=habit');
expect(tasks.length).to.equal(1);
expect(tasks[0]._id).to.equal(createdTasks[0]._id);
});