Merge branch 'api-v3-groups' into api-v3-groups-create-and-populate
This commit is contained in:
@@ -14,7 +14,7 @@ describe('DELETE /tasks/:id', () => {
|
||||
let task;
|
||||
|
||||
beforeEach(async () => {
|
||||
task = await user.post('/tasks', {
|
||||
task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
@@ -42,7 +42,7 @@ describe('DELETE /tasks/:id', () => {
|
||||
|
||||
it('cannot delete a task owned by someone else', async () => {
|
||||
let anotherUser = await generateUser();
|
||||
let anotherUsersTask = await anotherUser.post('/tasks', {
|
||||
let anotherUsersTask = await anotherUser.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
import Q from 'q';
|
||||
|
||||
describe('GET /tasks', () => {
|
||||
let user;
|
||||
|
||||
beforeEach(async () => {
|
||||
user = await generateUser();
|
||||
});
|
||||
|
||||
it('returns all user\'s tasks', async () => {
|
||||
let createdTasks = await Q.all([
|
||||
user.post('/tasks', {text: 'test habit', type: 'habit'}),
|
||||
]);
|
||||
|
||||
let length = createdTasks.length;
|
||||
let tasks = await user.get('/tasks');
|
||||
|
||||
expect(tasks.length).to.equal(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 task = await user.post('/tasks', {text: 'test habit', type: 'habit'});
|
||||
let tasks = await user.get('/tasks?type=habit');
|
||||
|
||||
expect(tasks.length).to.equal(1);
|
||||
expect(tasks[0]._id).to.equal(task._id);
|
||||
});
|
||||
|
||||
// TODO complete after task scoring is done
|
||||
it('returns completed todos sorted by creation date if req.query.includeCompletedTodos is specified');
|
||||
});
|
||||
@@ -15,7 +15,7 @@ describe('GET /tasks/:id', () => {
|
||||
let task;
|
||||
|
||||
beforeEach(async () => {
|
||||
task = await user.post('/tasks', {
|
||||
task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
@@ -43,7 +43,7 @@ describe('GET /tasks/:id', () => {
|
||||
|
||||
it('cannot get a task owned by someone else', async () => {
|
||||
let anotherUser = await generateUser();
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-integration.helper';
|
||||
|
||||
describe('GET /tasks/user', () => {
|
||||
let user;
|
||||
|
||||
beforeEach(async () => {
|
||||
user = await generateUser();
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
@@ -35,7 +35,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
let todo;
|
||||
|
||||
beforeEach(async () => {
|
||||
todo = await user.post('/tasks', {
|
||||
todo = await user.post('/tasks/user', {
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
});
|
||||
@@ -134,7 +134,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
let daily;
|
||||
|
||||
beforeEach(async () => {
|
||||
daily = await user.post('/tasks', {
|
||||
daily = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
});
|
||||
@@ -205,24 +205,24 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
let habit, minusHabit, plusHabit, neitherHabit; // eslint-disable-line no-unused-vars
|
||||
|
||||
beforeEach(async () => {
|
||||
habit = await user.post('/tasks', {
|
||||
habit = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
|
||||
minusHabit = await user.post('/tasks', {
|
||||
minusHabit = await user.post('/tasks/user', {
|
||||
text: 'test min habit',
|
||||
type: 'habit',
|
||||
up: false,
|
||||
});
|
||||
|
||||
plusHabit = await user.post('/tasks', {
|
||||
plusHabit = await user.post('/tasks/user', {
|
||||
text: 'test plus habit',
|
||||
type: 'habit',
|
||||
down: false,
|
||||
});
|
||||
|
||||
neitherHabit = await user.post('/tasks', {
|
||||
neitherHabit = await user.post('/tasks/user', {
|
||||
text: 'test neither habit',
|
||||
type: 'habit',
|
||||
up: false,
|
||||
@@ -267,7 +267,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
let reward, updatedUser;
|
||||
|
||||
beforeEach(async () => {
|
||||
reward = await user.post('/tasks', {
|
||||
reward = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
value: 5,
|
||||
|
||||
+42
-38
@@ -3,7 +3,7 @@ import {
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
|
||||
describe('POST /tasks', () => {
|
||||
describe('POST /tasks/user', () => {
|
||||
let user;
|
||||
|
||||
before(async () => {
|
||||
@@ -12,7 +12,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
context('validates params', async () => {
|
||||
it('returns an error if req.body.type is absent', async () => {
|
||||
await expect(user.post('/tasks', {
|
||||
await expect(user.post('/tasks/user', {
|
||||
notType: 'habit',
|
||||
})).to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -22,7 +22,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('returns an error if req.body.type is not valid', async () => {
|
||||
await expect(user.post('/tasks', {
|
||||
await expect(user.post('/tasks/user', {
|
||||
type: 'habitF',
|
||||
})).to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -32,7 +32,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('returns an error if one object inside an array is invalid', async () => {
|
||||
await expect(user.post('/tasks', [
|
||||
await expect(user.post('/tasks/user', [
|
||||
{type: 'habitF'},
|
||||
{type: 'habit'},
|
||||
])).to.eventually.be.rejected.and.eql({
|
||||
@@ -43,7 +43,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('returns an error if req.body.text is absent', async () => {
|
||||
await expect(user.post('/tasks', {
|
||||
await expect(user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
})).to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -54,7 +54,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('does not update user.tasksOrder.{taskType} when the task is not saved because invalid', async () => {
|
||||
let originalHabitsOrder = (await user.get('/user')).tasksOrder.habits;
|
||||
await expect(user.post('/tasks', {
|
||||
await expect(user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
})).to.eventually.be.rejected.and.eql({ // this block is necessary
|
||||
code: 400,
|
||||
@@ -68,7 +68,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('does not update user.tasksOrder.{taskType} when a task inside an array is not saved because invalid', async () => {
|
||||
let originalHabitsOrder = (await user.get('/user')).tasksOrder.habits;
|
||||
await expect(user.post('/tasks', [
|
||||
await expect(user.post('/tasks/user', [
|
||||
{type: 'habit'}, // Missing text
|
||||
{type: 'habit', text: 'valid'}, // Valid
|
||||
])).to.eventually.be.rejected.and.eql({ // this block is necessary
|
||||
@@ -82,14 +82,18 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('does not save any task sent in an array when 1 is invalid', async () => {
|
||||
let originalTasks = await user.get('/tasks');
|
||||
await expect(user.post('/tasks', [
|
||||
let originalTasks = await user.get('/tasks/user');
|
||||
await expect(user.post('/tasks/user', [
|
||||
{type: 'habit'}, // Missing text
|
||||
{type: 'habit', text: 'valid'}, // Valid
|
||||
])).to.eventually.be.rejected.and.eql({ // this block is necessary
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: 'habit validation failed',
|
||||
}).then(async () => {
|
||||
let updatedTasks = await user.get('/tasks/user');
|
||||
|
||||
expect(updatedTasks).to.eql(originalTasks);
|
||||
});
|
||||
|
||||
let updatedTasks = await user.get('/tasks');
|
||||
@@ -97,7 +101,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('automatically sets "task.userId" to user\'s uuid', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
@@ -108,7 +112,7 @@ describe('POST /tasks', () => {
|
||||
it(`ignores setting userId, history, createdAt,
|
||||
updatedAt, challenge, completed, streak,
|
||||
dateCompleted fields`, async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
userId: 123,
|
||||
@@ -132,7 +136,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('ignores invalid fields', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
notValid: true,
|
||||
@@ -144,7 +148,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
context('habits', () => {
|
||||
it('creates a habit', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
up: false,
|
||||
@@ -162,7 +166,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.habits when a new habit is created', async () => {
|
||||
let originalHabitsOrderLen = (await user.get('/user')).tasksOrder.habits.length;
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'an habit',
|
||||
});
|
||||
@@ -174,7 +178,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.habits when multiple habits are created', async () => {
|
||||
let originalHabitsOrderLen = (await user.get('/user')).tasksOrder.habits.length;
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
type: 'habit',
|
||||
text: 'an habit',
|
||||
}, {
|
||||
@@ -189,7 +193,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('creates multiple habits', async () => {
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
up: false,
|
||||
@@ -219,7 +223,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('defaults to setting up and down to true', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
notes: 1976,
|
||||
@@ -230,7 +234,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('cannot create checklists', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
checklist: [
|
||||
@@ -244,7 +248,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
context('todos', () => {
|
||||
it('creates a todo', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
notes: 1976,
|
||||
@@ -257,7 +261,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('creates multiple todos', async () => {
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
notes: 1976,
|
||||
@@ -280,7 +284,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.todos when a new todo is created', async () => {
|
||||
let originalTodosOrderLen = (await user.get('/user')).tasksOrder.todos.length;
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'todo',
|
||||
text: 'a todo',
|
||||
});
|
||||
@@ -292,7 +296,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.todos when multiple todos are created', async () => {
|
||||
let originalTodosOrderLen = (await user.get('/user')).tasksOrder.todos.length;
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
type: 'todo',
|
||||
text: 'a todo',
|
||||
}, {
|
||||
@@ -307,7 +311,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('can create checklists', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
checklist: [
|
||||
@@ -328,7 +332,7 @@ describe('POST /tasks', () => {
|
||||
it('creates a daily', async () => {
|
||||
let now = new Date();
|
||||
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
notes: 1976,
|
||||
@@ -347,7 +351,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('creates multiple dailys', async () => {
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
notes: 1976,
|
||||
@@ -370,7 +374,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.dailys when a new daily is created', async () => {
|
||||
let originalDailysOrderLen = (await user.get('/user')).tasksOrder.dailys.length;
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'a daily',
|
||||
});
|
||||
@@ -382,7 +386,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.dailys when multiple dailys are created', async () => {
|
||||
let originalDailysOrderLen = (await user.get('/user')).tasksOrder.dailys.length;
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
type: 'daily',
|
||||
text: 'a daily',
|
||||
}, {
|
||||
@@ -397,7 +401,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('defaults to a weekly frequency, with every day set', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
});
|
||||
@@ -416,7 +420,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('allows repeat field to be configured', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
repeat: {
|
||||
@@ -440,7 +444,7 @@ describe('POST /tasks', () => {
|
||||
it('defaults startDate to today', async () => {
|
||||
let today = (new Date()).getDay();
|
||||
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
});
|
||||
@@ -449,7 +453,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('can create checklists', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
checklist: [
|
||||
@@ -468,7 +472,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
context('rewards', () => {
|
||||
it('creates a reward', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
notes: 1976,
|
||||
@@ -483,7 +487,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('creates multiple rewards', async () => {
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
notes: 1976,
|
||||
@@ -510,7 +514,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.rewards when a new reward is created', async () => {
|
||||
let originalRewardsOrderLen = (await user.get('/user')).tasksOrder.rewards.length;
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'reward',
|
||||
text: 'a reward',
|
||||
});
|
||||
@@ -522,7 +526,7 @@ describe('POST /tasks', () => {
|
||||
|
||||
it('updates user.tasksOrder.dreward when multiple rewards are created', async () => {
|
||||
let originalRewardsOrderLen = (await user.get('/user')).tasksOrder.rewards.length;
|
||||
let [task, task2] = await user.post('/tasks', [{
|
||||
let [task, task2] = await user.post('/tasks/user', [{
|
||||
type: 'reward',
|
||||
text: 'a reward',
|
||||
}, {
|
||||
@@ -537,7 +541,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('defaults to a 0 value', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
});
|
||||
@@ -546,7 +550,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('requires value to be coerced into a number', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
value: '10',
|
||||
@@ -556,7 +560,7 @@ describe('POST /tasks', () => {
|
||||
});
|
||||
|
||||
it('cannot create checklists', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
checklist: [
|
||||
@@ -14,7 +14,7 @@ describe('PUT /tasks/:id', () => {
|
||||
let task;
|
||||
|
||||
beforeEach(async () => {
|
||||
task = await user.post('/tasks', {
|
||||
task = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
});
|
||||
@@ -61,7 +61,7 @@ describe('PUT /tasks/:id', () => {
|
||||
let habit;
|
||||
|
||||
beforeEach(async () => {
|
||||
habit = await user.post('/tasks', {
|
||||
habit = await user.post('/tasks/user', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
notes: 1976,
|
||||
@@ -87,7 +87,7 @@ describe('PUT /tasks/:id', () => {
|
||||
let todo;
|
||||
|
||||
beforeEach(async () => {
|
||||
todo = await user.post('/tasks', {
|
||||
todo = await user.post('/tasks/user', {
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
notes: 1976,
|
||||
@@ -142,7 +142,7 @@ describe('PUT /tasks/:id', () => {
|
||||
let daily;
|
||||
|
||||
beforeEach(async () => {
|
||||
daily = await user.post('/tasks', {
|
||||
daily = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
notes: 1976,
|
||||
@@ -244,7 +244,7 @@ describe('PUT /tasks/:id', () => {
|
||||
let reward;
|
||||
|
||||
beforeEach(async () => {
|
||||
reward = await user.post('/tasks', {
|
||||
reward = await user.post('/tasks/user', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
notes: 1976,
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('deletes a checklist item', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'Daily with checklist',
|
||||
});
|
||||
@@ -26,7 +26,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('does not work with habits', async () => {
|
||||
let habit = await user.post('/tasks', {
|
||||
let habit = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'habit with checklist',
|
||||
});
|
||||
@@ -39,7 +39,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('does not work with rewards', async () => {
|
||||
let reward = await user.post('/tasks', {
|
||||
let reward = await user.post('/tasks/user', {
|
||||
type: 'reward',
|
||||
text: 'reward with checklist',
|
||||
});
|
||||
@@ -60,7 +60,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('fails on checklist item not found', async () => {
|
||||
let createdTask = await user.post('/tasks', {
|
||||
let createdTask = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'daily with checklist',
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('POST /tasks/:taskId/checklist/', () => {
|
||||
});
|
||||
|
||||
it('adds a checklist item to a task', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'Daily with checklist',
|
||||
});
|
||||
@@ -32,7 +32,7 @@ describe('POST /tasks/:taskId/checklist/', () => {
|
||||
});
|
||||
|
||||
it('does not add a checklist to habits', async () => {
|
||||
let habit = await user.post('/tasks', {
|
||||
let habit = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'habit with checklist',
|
||||
});
|
||||
@@ -47,7 +47,7 @@ describe('POST /tasks/:taskId/checklist/', () => {
|
||||
});
|
||||
|
||||
it('does not add a checklist to rewards', async () => {
|
||||
let reward = await user.post('/tasks', {
|
||||
let reward = await user.post('/tasks/user', {
|
||||
type: 'reward',
|
||||
text: 'reward with checklist',
|
||||
});
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
|
||||
});
|
||||
|
||||
it('scores a checklist item', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'Daily with checklist',
|
||||
});
|
||||
@@ -29,7 +29,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
|
||||
});
|
||||
|
||||
it('fails on habits', async () => {
|
||||
let habit = await user.post('/tasks', {
|
||||
let habit = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'habit with checklist',
|
||||
});
|
||||
@@ -44,7 +44,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
|
||||
});
|
||||
|
||||
it('fails on rewards', async () => {
|
||||
let reward = await user.post('/tasks', {
|
||||
let reward = await user.post('/tasks/user', {
|
||||
type: 'reward',
|
||||
text: 'reward with checklist',
|
||||
});
|
||||
@@ -65,7 +65,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
|
||||
});
|
||||
|
||||
it('fails on checklist item not found', async () => {
|
||||
let createdTask = await user.post('/tasks', {
|
||||
let createdTask = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'daily with checklist',
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('updates a checklist item', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'Daily with checklist',
|
||||
});
|
||||
@@ -35,7 +35,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('fails on habits', async () => {
|
||||
let habit = await user.post('/tasks', {
|
||||
let habit = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'habit with checklist',
|
||||
});
|
||||
@@ -48,7 +48,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('fails on rewards', async () => {
|
||||
let reward = await user.post('/tasks', {
|
||||
let reward = await user.post('/tasks/user', {
|
||||
type: 'reward',
|
||||
text: 'reward with checklist',
|
||||
});
|
||||
@@ -69,7 +69,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
|
||||
});
|
||||
|
||||
it('fails on checklist item not found', async () => {
|
||||
let createdTask = await user.post('/tasks', {
|
||||
let createdTask = await user.post('/tasks/user', {
|
||||
type: 'daily',
|
||||
text: 'daily with checklist',
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('DELETE /tasks/:taskId/tags/:tagId', () => {
|
||||
});
|
||||
|
||||
it('removes a tag from a task', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'Task with tag',
|
||||
});
|
||||
@@ -28,7 +28,7 @@ describe('DELETE /tasks/:taskId/tags/:tagId', () => {
|
||||
});
|
||||
|
||||
it('only deletes existing tags', async () => {
|
||||
let createdTask = await user.post('/tasks', {
|
||||
let createdTask = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'Task with tag',
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('POST /tasks/:taskId/tags/:tagId', () => {
|
||||
});
|
||||
|
||||
it('adds a tag to a task', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'Task with tag',
|
||||
});
|
||||
@@ -24,7 +24,7 @@ describe('POST /tasks/:taskId/tags/:tagId', () => {
|
||||
});
|
||||
|
||||
it('does not add a tag to a task twice', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'Task with tag',
|
||||
});
|
||||
@@ -41,7 +41,7 @@ describe('POST /tasks/:taskId/tags/:tagId', () => {
|
||||
});
|
||||
|
||||
it('does not add a non existing tag to a task', async () => {
|
||||
let task = await user.post('/tasks', {
|
||||
let task = await user.post('/tasks/user', {
|
||||
type: 'habit',
|
||||
text: 'Task with tag',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user