fix test lint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 20:45:38 +02:00
parent e37f4467f8
commit 85fb5f33aa
367 changed files with 6635 additions and 6080 deletions

View File

@@ -1,8 +1,8 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
translate as t,
} from '../../../../../helpers/api-integration/v3';
import { v4 as generateUUID } from 'uuid';
describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
let user;
@@ -12,12 +12,12 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
});
it('deletes a checklist item', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
});
let savedTask = await user.post(`/tasks/${task._id}/checklist`, {text: 'Checklist Item 1', completed: false});
let savedTask = await user.post(`/tasks/${task._id}/checklist`, { text: 'Checklist Item 1', completed: false });
await user.del(`/tasks/${task._id}/checklist/${savedTask.checklist[0].id}`);
savedTask = await user.get(`/tasks/${task._id}`);
@@ -26,13 +26,13 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
});
it('deletes a checklist item using task alias', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
alias: 'daily-with-alias',
});
let savedTask = await user.post(`/tasks/${task._id}/checklist`, {text: 'Checklist Item 1', completed: false});
let savedTask = await user.post(`/tasks/${task._id}/checklist`, { text: 'Checklist Item 1', completed: false });
await user.del(`/tasks/${task.alias}/checklist/${savedTask.checklist[0].id}`);
savedTask = await user.get(`/tasks/${task._id}`);
@@ -41,7 +41,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
});
it('does not work with habits', async () => {
let habit = await user.post('/tasks/user', {
const habit = await user.post('/tasks/user', {
type: 'habit',
text: 'habit with checklist',
});
@@ -54,7 +54,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
});
it('does not work with rewards', async () => {
let reward = await user.post('/tasks/user', {
const reward = await user.post('/tasks/user', {
type: 'reward',
text: 'reward with checklist',
});
@@ -75,7 +75,7 @@ describe('DELETE /tasks/:taskId/checklist/:itemId', () => {
});
it('fails on checklist item not found', async () => {
let createdTask = await user.post('/tasks/user', {
const createdTask = await user.post('/tasks/user', {
type: 'daily',
text: 'daily with checklist',
});

View File

@@ -1,8 +1,8 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
translate as t,
} from '../../../../../helpers/api-integration/v3';
import { v4 as generateUUID } from 'uuid';
describe('POST /tasks/:taskId/checklist/', () => {
let user;
@@ -12,12 +12,12 @@ describe('POST /tasks/:taskId/checklist/', () => {
});
it('adds a checklist item to a task', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
});
let savedTask = await user.post(`/tasks/${task._id}/checklist`, {
const savedTask = await user.post(`/tasks/${task._id}/checklist`, {
text: 'Checklist Item 1',
ignored: false,
_id: 123,
@@ -32,13 +32,13 @@ describe('POST /tasks/:taskId/checklist/', () => {
});
it('can use a alias to add checklist', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
alias: 'task-with-shortname',
});
let savedTask = await user.post(`/tasks/${task.alias}/checklist`, {
const savedTask = await user.post(`/tasks/${task.alias}/checklist`, {
text: 'Checklist Item 1',
ignored: false,
_id: 123,
@@ -53,7 +53,7 @@ describe('POST /tasks/:taskId/checklist/', () => {
});
it('does not add a checklist to habits', async () => {
let habit = await user.post('/tasks/user', {
const habit = await user.post('/tasks/user', {
type: 'habit',
text: 'habit with checklist',
});
@@ -68,7 +68,7 @@ describe('POST /tasks/:taskId/checklist/', () => {
});
it('does not add a checklist to rewards', async () => {
let reward = await user.post('/tasks/user', {
const reward = await user.post('/tasks/user', {
type: 'reward',
text: 'reward with checklist',
});

View File

@@ -1,10 +1,10 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
translate as t,
server,
sleep,
} from '../../../../../helpers/api-integration/v3';
import { v4 as generateUUID } from 'uuid';
describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
let user;
@@ -14,7 +14,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('scores a checklist item', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
});
@@ -31,7 +31,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('can use a alias to score a checklist item', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
alias: 'daily-with-shortname',
@@ -49,7 +49,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('fails on habits', async () => {
let habit = await user.post('/tasks/user', {
const habit = await user.post('/tasks/user', {
type: 'habit',
text: 'habit with checklist',
});
@@ -64,7 +64,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('fails on rewards', async () => {
let reward = await user.post('/tasks/user', {
const reward = await user.post('/tasks/user', {
type: 'reward',
text: 'reward with checklist',
});
@@ -85,7 +85,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('fails on checklist item not found', async () => {
let createdTask = await user.post('/tasks/user', {
const createdTask = await user.post('/tasks/user', {
type: 'daily',
text: 'daily with checklist',
});
@@ -107,7 +107,7 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
});
it('sends task activity webhooks', async () => {
let uuid = generateUUID();
const uuid = generateUUID();
await user.post('/user/webhook', {
url: `http://localhost:${server.port}/webhooks/${uuid}`,
@@ -119,22 +119,22 @@ describe('POST /tasks/:taskId/checklist/:itemId/score', () => {
},
});
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
text: 'test daily',
type: 'daily',
});
let updatedTask = await user.post(`/tasks/${task.id}/checklist`, {
const updatedTask = await user.post(`/tasks/${task.id}/checklist`, {
text: 'checklist item text',
});
let checklistItem = updatedTask.checklist[0];
const checklistItem = updatedTask.checklist[0];
let scoredItemTask = await user.post(`/tasks/${task.id}/checklist/${checklistItem.id}/score`);
const scoredItemTask = await user.post(`/tasks/${task.id}/checklist/${checklistItem.id}/score`);
await sleep();
let body = server.getWebhookData(uuid);
const body = server.getWebhookData(uuid);
expect(body.type).to.eql('checklistScored');
expect(body.task).to.eql(scoredItemTask);

View File

@@ -1,8 +1,8 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
translate as t,
} from '../../../../../helpers/api-integration/v3';
import { v4 as generateUUID } from 'uuid';
describe('PUT /tasks/:taskId/checklist/:itemId', () => {
let user;
@@ -12,7 +12,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
});
it('updates a checklist item', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
});
@@ -35,7 +35,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
});
it('updates a checklist item using task alias', async () => {
let task = await user.post('/tasks/user', {
const task = await user.post('/tasks/user', {
type: 'daily',
text: 'Daily with checklist',
alias: 'daily-with-shortname',
@@ -59,7 +59,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
});
it('fails on habits', async () => {
let habit = await user.post('/tasks/user', {
const habit = await user.post('/tasks/user', {
type: 'habit',
text: 'habit with checklist',
});
@@ -72,7 +72,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
});
it('fails on rewards', async () => {
let reward = await user.post('/tasks/user', {
const reward = await user.post('/tasks/user', {
type: 'reward',
text: 'reward with checklist',
});
@@ -93,7 +93,7 @@ describe('PUT /tasks/:taskId/checklist/:itemId', () => {
});
it('fails on checklist item not found', async () => {
let createdTask = await user.post('/tasks/user', {
const createdTask = await user.post('/tasks/user', {
type: 'daily',
text: 'daily with checklist',
});