lint: Fix tests that can be fixed with the eslint --fix flag

This commit is contained in:
Blade Barringer
2015-12-30 21:16:26 -06:00
parent 6f220c6869
commit 70151fd073
14 changed files with 41 additions and 41 deletions

View File

@@ -75,8 +75,8 @@ describe('POST /group', () => {
context('Parties', () => { context('Parties', () => {
it('creates a party', () => { it('creates a party', () => {
let groupName = "Test Party"; let groupName = 'Test Party';
let groupType = "party"; let groupType = 'party';
return user.post('/groups', { return user.post('/groups', {
name: groupName, name: groupName,
@@ -86,13 +86,13 @@ describe('POST /group', () => {
expect(result._id).to.exist; expect(result._id).to.exist;
expect(result.name).to.equal(groupName); expect(result.name).to.equal(groupName);
expect(result.type).to.equal(groupType); expect(result.type).to.equal(groupType);
}) });
}); });
it('prevents user in a party from creating another party', () => { it('prevents user in a party from creating another party', () => {
let tmpUser; let tmpUser;
let groupName = "Test Party"; let groupName = 'Test Party';
let groupType = "party"; let groupType = 'party';
return generateUser().then((generatedUser) => { return generateUser().then((generatedUser) => {
tmpUser = generatedUser; tmpUser = generatedUser;

View File

@@ -17,7 +17,7 @@ describe('GET /tags/:tagId', () => {
return user.post('/tags', {name: 'Tag 1'}) return user.post('/tags', {name: 'Tag 1'})
.then((tag) => { .then((tag) => {
createdTag = tag; createdTag = tag;
return user.get(`/tags/${createdTag._id}`) return user.get(`/tags/${createdTag._id}`);
}) })
.then((tag) => { .then((tag) => {
expect(tag).to.deep.equal(createdTag); expect(tag).to.deep.equal(createdTag);

View File

@@ -41,5 +41,5 @@ describe('GET /tasks', () => {
}); });
// TODO complete after task scoring is done // TODO complete after task scoring is done
it('returns completed todos sorted by creation date if req.query.includeCompletedTodos is specified') it('returns completed todos sorted by creation date if req.query.includeCompletedTodos is specified');
}); });

View File

@@ -284,7 +284,7 @@ describe('POST /tasks', () => {
return user.post('/tasks', { return user.post('/tasks', {
text: 'test reward', text: 'test reward',
type: 'reward', type: 'reward',
value: "10", value: '10',
}).then((task) => { }).then((task) => {
expect(task.value).to.eql(10); expect(task.value).to.eql(10);
}); });

View File

@@ -54,7 +54,7 @@ describe('POST /tasks/:id/score/:direction', () => {
it('moves completed todos out of user.tasksOrder.todos', () => { it('moves completed todos out of user.tasksOrder.todos', () => {
return user.get('/user') return user.get('/user')
.then(user => { .then(user => {
expect(user.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1) expect(user.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1);
}).then(() => user.post(`/tasks/${todo._id}/score/up`)) }).then(() => user.post(`/tasks/${todo._id}/score/up`))
.then(() => user.get(`/tasks/${todo._id}`)) .then(() => user.get(`/tasks/${todo._id}`))
.then((updatedTask) => { .then((updatedTask) => {
@@ -62,14 +62,14 @@ describe('POST /tasks/:id/score/:direction', () => {
return user.get('/user'); return user.get('/user');
}) })
.then((user) => { .then((user) => {
expect(user.tasksOrder.todos.indexOf(todo._id)).to.equal(-1) expect(user.tasksOrder.todos.indexOf(todo._id)).to.equal(-1);
}); });
}); });
it('moves un-completed todos back into user.tasksOrder.todos', () => { it('moves un-completed todos back into user.tasksOrder.todos', () => {
return user.get('/user') return user.get('/user')
.then(user => { .then(user => {
expect(user.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1) expect(user.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1);
}).then(() => user.post(`/tasks/${todo._id}/score/up`)) }).then(() => user.post(`/tasks/${todo._id}/score/up`))
.then(() => user.post(`/tasks/${todo._id}/score/down`)) .then(() => user.post(`/tasks/${todo._id}/score/down`))
.then(() => user.get(`/tasks/${todo._id}`)) .then(() => user.get(`/tasks/${todo._id}`))
@@ -242,7 +242,7 @@ describe('POST /tasks/:id/score/:direction', () => {
text: 'test plus habit', text: 'test plus habit',
type: 'habit', type: 'habit',
down: false, down: false,
}) });
}).then((task) => { }).then((task) => {
plusHabit = task; plusHabit = task;
user.post('/tasks', { user.post('/tasks', {
@@ -250,7 +250,7 @@ describe('POST /tasks/:id/score/:direction', () => {
type: 'habit', type: 'habit',
up: false, up: false,
down: false, down: false,
}) });
}).then((task) => { }).then((task) => {
neitherHabit = task; neitherHabit = task;
}); });

View File

@@ -127,7 +127,7 @@ describe('PUT /tasks/:id', () => {
}); });
}).then((savedTodo2) => { }).then((savedTodo2) => {
expect(savedTodo2.checklist.length).to.equal(1); expect(savedTodo2.checklist.length).to.equal(1);
expect(savedTodo2.checklist[0].text).to.equal("789"); expect(savedTodo2.checklist[0].text).to.equal('789');
expect(savedTodo2.checklist[0].completed).to.equal(false); expect(savedTodo2.checklist[0].completed).to.equal(false);
}); });
}); });
@@ -190,7 +190,7 @@ describe('PUT /tasks/:id', () => {
}); });
}).then((savedDaily2) => { }).then((savedDaily2) => {
expect(savedDaily2.checklist.length).to.equal(1); expect(savedDaily2.checklist.length).to.equal(1);
expect(savedDaily2.checklist[0].text).to.equal("789"); expect(savedDaily2.checklist[0].text).to.equal('789');
expect(savedDaily2.checklist[0].completed).to.equal(false); expect(savedDaily2.checklist[0].completed).to.equal(false);
}); });
}); });
@@ -281,7 +281,7 @@ describe('PUT /tasks/:id', () => {
it('requires value to be coerced into a number', () => { it('requires value to be coerced into a number', () => {
return user.put(`/tasks/${reward._id}`, { return user.put(`/tasks/${reward._id}`, {
value: "100", value: '100',
}).then((task) => { }).then((task) => {
expect(task.value).to.eql(100); expect(task.value).to.eql(100);
}); });

View File

@@ -68,7 +68,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for gear if itemKey is provided', () => { it('sends english item name for gear if itemKey is provided', () => {
data.itemKey = 'headAccessory_special_foxEars' data.itemKey = 'headAccessory_special_foxEars';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Fox%20Ears.*/g, ''); .filteringPath(/httpapi.*itemName.*Fox%20Ears.*/g, '');
@@ -80,7 +80,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for egg if itemKey is provided', () => { it('sends english item name for egg if itemKey is provided', () => {
data.itemKey = 'Wolf' data.itemKey = 'Wolf';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Wolf%20Egg.*/g, ''); .filteringPath(/httpapi.*itemName.*Wolf%20Egg.*/g, '');
@@ -92,7 +92,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for food if itemKey is provided', () => { it('sends english item name for food if itemKey is provided', () => {
data.itemKey = 'Cake_Skeleton' data.itemKey = 'Cake_Skeleton';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Bare%20Bones%20Cake.*/g, ''); .filteringPath(/httpapi.*itemName.*Bare%20Bones%20Cake.*/g, '');
@@ -104,7 +104,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for hatching potion if itemKey is provided', () => { it('sends english item name for hatching potion if itemKey is provided', () => {
data.itemKey = 'Golden' data.itemKey = 'Golden';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Golden%20Hatching%20Potion.*/g, ''); .filteringPath(/httpapi.*itemName.*Golden%20Hatching%20Potion.*/g, '');
@@ -116,7 +116,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for quest if itemKey is provided', () => { it('sends english item name for quest if itemKey is provided', () => {
data.itemKey = 'atom1' data.itemKey = 'atom1';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Attack%20of%20the%20Mundane%2C%20Part%201%3A%20Dish%20Disaster!.*/g, ''); .filteringPath(/httpapi.*itemName.*Attack%20of%20the%20Mundane%2C%20Part%201%3A%20Dish%20Disaster!.*/g, '');
@@ -128,7 +128,7 @@ describe('analyticsService', () => {
}); });
it('sends english item name for purchased spell if itemKey is provided', () => { it('sends english item name for purchased spell if itemKey is provided', () => {
data.itemKey = 'seafoam' data.itemKey = 'seafoam';
amplitudeNock amplitudeNock
.filteringPath(/httpapi.*itemName.*Seafoam.*/g, ''); .filteringPath(/httpapi.*itemName.*Seafoam.*/g, '');

View File

@@ -11,7 +11,7 @@ describe('Build Manifest', () => {
}); });
it('throws an error in case the page does not exist', () => { it('throws an error in case the page does not exist', () => {
let getManifestFilesFn = () => { getManifestFiles('strange name here') }; let getManifestFilesFn = () => { getManifestFiles('strange name here'); };
expect(getManifestFilesFn).to.throw(Error); expect(getManifestFilesFn).to.throw(Error);
}); });
}); });

View File

@@ -28,7 +28,7 @@ function getUser () {
}, },
}, },
}; };
}; }
describe('emails', () => { describe('emails', () => {
let pathToEmailLib = '../../../../../website/src/libs/api-v3/email'; let pathToEmailLib = '../../../../../website/src/libs/api-v3/email';
@@ -97,7 +97,7 @@ describe('emails', () => {
delete user.auth['local']; delete user.auth['local'];
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']); let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
expect(data).to.have.property('name', user.auth.facebook.displayName); expect(data).to.have.property('name', user.auth.facebook.displayName);
expect(data).to.have.property('email', user.auth.facebook.emails[0].value); expect(data).to.have.property('email', user.auth.facebook.emails[0].value);
expect(data).to.have.property('_id', user._id); expect(data).to.have.property('_id', user._id);
@@ -109,11 +109,11 @@ describe('emails', () => {
let getUserInfo = attachEmail.getUserInfo; let getUserInfo = attachEmail.getUserInfo;
let user = getUser(); let user = getUser();
delete user.profile['name']; delete user.profile['name'];
delete user.auth.local['email'] delete user.auth.local['email'];
delete user.auth['facebook']; delete user.auth['facebook'];
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']); let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
expect(data).to.have.property('name', user.auth.local.username); expect(data).to.have.property('name', user.auth.local.username);
expect(data).not.to.have.property('email'); expect(data).not.to.have.property('email');
expect(data).to.have.property('_id', user._id); expect(data).to.have.property('_id', user._id);
@@ -194,7 +194,7 @@ describe('emails', () => {
name: 'my name', name: 'my name',
email: 'my@email', email: 'my@email',
}; };
let variables = [1,2,3]; let variables = [1, 2, 3];
sendTxnEmail(mailingInfo, emailType, variables); sendTxnEmail(mailingInfo, emailType, variables);
expect(request.post).to.be.calledWith(sinon.match({ expect(request.post).to.be.calledWith(sinon.match({
@@ -204,8 +204,8 @@ describe('emails', () => {
return value[0].name === 'BASE_URL'; return value[0].name === 'BASE_URL';
}, 'matches variables'), }, 'matches variables'),
personalVariables: sinon.match((value) => { personalVariables: sinon.match((value) => {
return (value[0].rcpt === mailingInfo.email return (value[0].rcpt === mailingInfo.email
&& value[0].vars[0].name === 'RECIPIENT_NAME' && value[0].vars[0].name === 'RECIPIENT_NAME'
&& value[0].vars[1].name === 'RECIPIENT_UNSUB_URL' && value[0].vars[1].name === 'RECIPIENT_UNSUB_URL'
); );
}, 'matches personal variables'), }, 'matches personal variables'),

View File

@@ -1,4 +1,4 @@
import { import {
encrypt, encrypt,
decrypt, decrypt,
} from '../../../../../website/src/libs/api-v3/encryption'; } from '../../../../../website/src/libs/api-v3/encryption';

View File

@@ -34,7 +34,7 @@ describe('i18n', () => {
describe('localePath', () => { describe('localePath', () => {
it('is an absolute path to common/locales/', () => { it('is an absolute path to common/locales/', () => {
expect(localePath).to.match(/.*\/common\/locales\//); expect(localePath).to.match(/.*\/common\/locales\//);
expect(localePath) expect(localePath);
}); });
}); });

View File

@@ -3,10 +3,10 @@ import {
generateReq, generateReq,
generateNext, generateNext,
} from '../../../../helpers/api-unit.helper'; } from '../../../../helpers/api-unit.helper';
import analyticsService from '../../../../../website/src/libs/api-v3/analyticsService' import analyticsService from '../../../../../website/src/libs/api-v3/analyticsService';
import nconf from 'nconf'; import nconf from 'nconf';
describe('analytics middleware', function() { describe('analytics middleware', function () {
let res, req, next; let res, req, next;
let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics'; let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics';
@@ -23,7 +23,7 @@ describe('analytics middleware', function() {
delete require.cache[require.resolve(pathToAnalyticsMiddleware)]; delete require.cache[require.resolve(pathToAnalyticsMiddleware)];
}); });
it('attaches analytics object res.locals', function() { it('attaches analytics object res.locals', function () {
let attachAnalytics = require(pathToAnalyticsMiddleware); let attachAnalytics = require(pathToAnalyticsMiddleware);
attachAnalytics(req, res, next); attachAnalytics(req, res, next);

View File

@@ -121,7 +121,7 @@ describe('getUserLanguage', () => {
context('request with session', () => { context('request with session', () => {
it('uses the user preferred language if avalaible', (done) => { it('uses the user preferred language if avalaible', (done) => {
sandbox.stub(User, 'findOne').returns({ sandbox.stub(User, 'findOne').returns({
exec() { exec () {
return Q.resolve({ return Q.resolve({
preferences: { preferences: {
language: 'it', language: 'it',

View File

@@ -3,9 +3,9 @@ import {
generateReq, generateReq,
generateNext, generateNext,
} from '../../../../helpers/api-unit.helper'; } from '../../../../helpers/api-unit.helper';
import responseMiddleware from '../../../../../website/src/middlewares/api-v3/response' import responseMiddleware from '../../../../../website/src/middlewares/api-v3/response';
describe('response middleware', function() { describe('response middleware', function () {
let res, req, next; let res, req, next;
beforeEach(() => { beforeEach(() => {
@@ -15,13 +15,13 @@ describe('response middleware', function() {
}); });
it('attaches respond method to res', function() { it('attaches respond method to res', function () {
responseMiddleware(req, res, next); responseMiddleware(req, res, next);
expect(res.respond).to.exist; expect(res.respond).to.exist;
}); });
it('can be used to respond to requests', function() { it('can be used to respond to requests', function () {
responseMiddleware(req, res, next); responseMiddleware(req, res, next);
res.respond(200, {field: 1}); res.respond(200, {field: 1});
@@ -34,7 +34,7 @@ describe('response middleware', function() {
}); });
}); });
it('treats status >= 400 as failures', function() { it('treats status >= 400 as failures', function () {
responseMiddleware(req, res, next); responseMiddleware(req, res, next);
res.respond(403, {field: 1}); res.respond(403, {field: 1});