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
+12 -10
View File
@@ -1,14 +1,15 @@
import { each } from 'lodash';
import { model as Challenge } from '../../../../website/server/models/challenge';
import { model as Group } from '../../../../website/server/models/group';
import { model as User } from '../../../../website/server/models/user';
import * as Tasks from '../../../../website/server/models/task';
import { InternalServerError } from '../../../../website/server/libs/errors';
import { each } from 'lodash';
import { generateHistory } from '../../../helpers/api-unit.helper.js';
import { generateHistory } from '../../../helpers/api-unit.helper';
describe('Task Model', () => {
let guild, leader, challenge, task;
let tasksToTest = {
let guild; let leader; let challenge; let
task;
const tasksToTest = {
habit: {
text: 'test habit',
type: 'habit',
@@ -62,11 +63,11 @@ describe('Task Model', () => {
});
it('preens challenge tasks history when scored', async () => {
let historyLengthBeforePreen = task.history.length;
const historyLengthBeforePreen = task.history.length;
await task.scoreChallengeTask(1.2);
let updatedTask = await Tasks.Task.findOne({_id: task._id});
const updatedTask = await Tasks.Task.findOne({ _id: task._id });
expect(historyLengthBeforePreen).to.be.greaterThan(updatedTask.history.length);
});
@@ -75,7 +76,8 @@ describe('Task Model', () => {
describe('Static Methods', () => {
describe('findByIdOrAlias', () => {
let taskWithAlias, user;
let taskWithAlias; let
user;
beforeEach(async () => {
user = new User();
@@ -112,13 +114,13 @@ describe('Task Model', () => {
});
it('returns task by id', async () => {
let foundTodo = await Tasks.Task.findByIdOrAlias(taskWithAlias._id, user._id);
const foundTodo = await Tasks.Task.findByIdOrAlias(taskWithAlias._id, user._id);
expect(foundTodo.text).to.eql(taskWithAlias.text);
});
it('returns task by alias', async () => {
let foundTodo = await Tasks.Task.findByIdOrAlias(taskWithAlias.alias, user._id);
const foundTodo = await Tasks.Task.findByIdOrAlias(taskWithAlias.alias, user._id);
expect(foundTodo.text).to.eql(taskWithAlias.text);
});
@@ -134,7 +136,7 @@ describe('Task Model', () => {
});
it('returns null if task cannot be found', async () => {
let foundTask = await Tasks.Task.findByIdOrAlias('not-found', user._id);
const foundTask = await Tasks.Task.findByIdOrAlias('not-found', user._id);
expect(foundTask).to.eql(null);
});