mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
rename tasks tests to match new routes
This commit is contained in:
33
test/api/v3/integration/tasks/GET-tasks_user.test.js
Normal file
33
test/api/v3/integration/tasks/GET-tasks_user.test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-integration.helper';
|
||||
|
||||
describe('GET /tasks/user', () => {
|
||||
let user;
|
||||
|
||||
beforeEach(async () => {
|
||||
user = await generateUser();
|
||||
});
|
||||
|
||||
before(async () => {
|
||||
return generateUser().then((generatedUser) => {
|
||||
user = generatedUser;
|
||||
});
|
||||
});
|
||||
|
||||
it('returns all user\'s tasks', async () => {
|
||||
let createdTasks = await user.post('/tasks/user', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
|
||||
let tasks = await user.get('/tasks/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/user', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
|
||||
let tasks = await user.get('/tasks/user?type=habit');
|
||||
expect(tasks.length).to.equal(1);
|
||||
expect(tasks[0]._id).to.equal(createdTasks[0]._id);
|
||||
});
|
||||
|
||||
// TODO complete after task scoring is done
|
||||
it('returns completed todos sorted by creation date if req.query.includeCompletedTodos is specified');
|
||||
});
|
||||
Reference in New Issue
Block a user