mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
lint: Fix tests that can be fixed with the eslint --fix flag
This commit is contained in:
@@ -75,8 +75,8 @@ describe('POST /group', () => {
|
||||
|
||||
context('Parties', () => {
|
||||
it('creates a party', () => {
|
||||
let groupName = "Test Party";
|
||||
let groupType = "party";
|
||||
let groupName = 'Test Party';
|
||||
let groupType = 'party';
|
||||
|
||||
return user.post('/groups', {
|
||||
name: groupName,
|
||||
@@ -86,13 +86,13 @@ describe('POST /group', () => {
|
||||
expect(result._id).to.exist;
|
||||
expect(result.name).to.equal(groupName);
|
||||
expect(result.type).to.equal(groupType);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('prevents user in a party from creating another party', () => {
|
||||
let tmpUser;
|
||||
let groupName = "Test Party";
|
||||
let groupType = "party";
|
||||
let groupName = 'Test Party';
|
||||
let groupType = 'party';
|
||||
|
||||
return generateUser().then((generatedUser) => {
|
||||
tmpUser = generatedUser;
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('GET /tags/:tagId', () => {
|
||||
return user.post('/tags', {name: 'Tag 1'})
|
||||
.then((tag) => {
|
||||
createdTag = tag;
|
||||
return user.get(`/tags/${createdTag._id}`)
|
||||
return user.get(`/tags/${createdTag._id}`);
|
||||
})
|
||||
.then((tag) => {
|
||||
expect(tag).to.deep.equal(createdTag);
|
||||
|
||||
@@ -41,5 +41,5 @@ describe('GET /tasks', () => {
|
||||
});
|
||||
|
||||
// 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');
|
||||
});
|
||||
|
||||
@@ -284,7 +284,7 @@ describe('POST /tasks', () => {
|
||||
return user.post('/tasks', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
value: "10",
|
||||
value: '10',
|
||||
}).then((task) => {
|
||||
expect(task.value).to.eql(10);
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
it('moves completed todos out of user.tasksOrder.todos', () => {
|
||||
return user.get('/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.get(`/tasks/${todo._id}`))
|
||||
.then((updatedTask) => {
|
||||
@@ -62,14 +62,14 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
return user.get('/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', () => {
|
||||
return user.get('/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/down`))
|
||||
.then(() => user.get(`/tasks/${todo._id}`))
|
||||
@@ -242,7 +242,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
text: 'test plus habit',
|
||||
type: 'habit',
|
||||
down: false,
|
||||
})
|
||||
});
|
||||
}).then((task) => {
|
||||
plusHabit = task;
|
||||
user.post('/tasks', {
|
||||
@@ -250,7 +250,7 @@ describe('POST /tasks/:id/score/:direction', () => {
|
||||
type: 'habit',
|
||||
up: false,
|
||||
down: false,
|
||||
})
|
||||
});
|
||||
}).then((task) => {
|
||||
neitherHabit = task;
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('PUT /tasks/:id', () => {
|
||||
});
|
||||
}).then((savedTodo2) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -190,7 +190,7 @@ describe('PUT /tasks/:id', () => {
|
||||
});
|
||||
}).then((savedDaily2) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -281,7 +281,7 @@ describe('PUT /tasks/:id', () => {
|
||||
|
||||
it('requires value to be coerced into a number', () => {
|
||||
return user.put(`/tasks/${reward._id}`, {
|
||||
value: "100",
|
||||
value: '100',
|
||||
}).then((task) => {
|
||||
expect(task.value).to.eql(100);
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('analyticsService', () => {
|
||||
});
|
||||
|
||||
it('sends english item name for gear if itemKey is provided', () => {
|
||||
data.itemKey = 'headAccessory_special_foxEars'
|
||||
data.itemKey = 'headAccessory_special_foxEars';
|
||||
|
||||
amplitudeNock
|
||||
.filteringPath(/httpapi.*itemName.*Fox%20Ears.*/g, '');
|
||||
@@ -80,7 +80,7 @@ describe('analyticsService', () => {
|
||||
});
|
||||
|
||||
it('sends english item name for egg if itemKey is provided', () => {
|
||||
data.itemKey = 'Wolf'
|
||||
data.itemKey = 'Wolf';
|
||||
|
||||
amplitudeNock
|
||||
.filteringPath(/httpapi.*itemName.*Wolf%20Egg.*/g, '');
|
||||
@@ -92,7 +92,7 @@ describe('analyticsService', () => {
|
||||
});
|
||||
|
||||
it('sends english item name for food if itemKey is provided', () => {
|
||||
data.itemKey = 'Cake_Skeleton'
|
||||
data.itemKey = 'Cake_Skeleton';
|
||||
|
||||
amplitudeNock
|
||||
.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', () => {
|
||||
data.itemKey = 'Golden'
|
||||
data.itemKey = 'Golden';
|
||||
|
||||
amplitudeNock
|
||||
.filteringPath(/httpapi.*itemName.*Golden%20Hatching%20Potion.*/g, '');
|
||||
@@ -116,7 +116,7 @@ describe('analyticsService', () => {
|
||||
});
|
||||
|
||||
it('sends english item name for quest if itemKey is provided', () => {
|
||||
data.itemKey = 'atom1'
|
||||
data.itemKey = 'atom1';
|
||||
|
||||
amplitudeNock
|
||||
.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', () => {
|
||||
data.itemKey = 'seafoam'
|
||||
data.itemKey = 'seafoam';
|
||||
|
||||
amplitudeNock
|
||||
.filteringPath(/httpapi.*itemName.*Seafoam.*/g, '');
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('Build Manifest', () => {
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ function getUser () {
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
describe('emails', () => {
|
||||
let pathToEmailLib = '../../../../../website/src/libs/api-v3/email';
|
||||
@@ -97,7 +97,7 @@ describe('emails', () => {
|
||||
delete user.auth['local'];
|
||||
|
||||
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
|
||||
|
||||
|
||||
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('_id', user._id);
|
||||
@@ -109,11 +109,11 @@ describe('emails', () => {
|
||||
let getUserInfo = attachEmail.getUserInfo;
|
||||
let user = getUser();
|
||||
delete user.profile['name'];
|
||||
delete user.auth.local['email']
|
||||
delete user.auth.local['email'];
|
||||
delete user.auth['facebook'];
|
||||
|
||||
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
|
||||
|
||||
|
||||
expect(data).to.have.property('name', user.auth.local.username);
|
||||
expect(data).not.to.have.property('email');
|
||||
expect(data).to.have.property('_id', user._id);
|
||||
@@ -194,7 +194,7 @@ describe('emails', () => {
|
||||
name: 'my name',
|
||||
email: 'my@email',
|
||||
};
|
||||
let variables = [1,2,3];
|
||||
let variables = [1, 2, 3];
|
||||
|
||||
sendTxnEmail(mailingInfo, emailType, variables);
|
||||
expect(request.post).to.be.calledWith(sinon.match({
|
||||
@@ -204,8 +204,8 @@ describe('emails', () => {
|
||||
return value[0].name === 'BASE_URL';
|
||||
}, 'matches variables'),
|
||||
personalVariables: sinon.match((value) => {
|
||||
return (value[0].rcpt === mailingInfo.email
|
||||
&& value[0].vars[0].name === 'RECIPIENT_NAME'
|
||||
return (value[0].rcpt === mailingInfo.email
|
||||
&& value[0].vars[0].name === 'RECIPIENT_NAME'
|
||||
&& value[0].vars[1].name === 'RECIPIENT_UNSUB_URL'
|
||||
);
|
||||
}, 'matches personal variables'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import {
|
||||
encrypt,
|
||||
decrypt,
|
||||
} from '../../../../../website/src/libs/api-v3/encryption';
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('i18n', () => {
|
||||
describe('localePath', () => {
|
||||
it('is an absolute path to common/locales/', () => {
|
||||
expect(localePath).to.match(/.*\/common\/locales\//);
|
||||
expect(localePath)
|
||||
expect(localePath);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} 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';
|
||||
|
||||
describe('analytics middleware', function() {
|
||||
describe('analytics middleware', function () {
|
||||
let res, req, next;
|
||||
let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics';
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('analytics middleware', function() {
|
||||
delete require.cache[require.resolve(pathToAnalyticsMiddleware)];
|
||||
});
|
||||
|
||||
it('attaches analytics object res.locals', function() {
|
||||
it('attaches analytics object res.locals', function () {
|
||||
let attachAnalytics = require(pathToAnalyticsMiddleware);
|
||||
|
||||
attachAnalytics(req, res, next);
|
||||
|
||||
@@ -121,7 +121,7 @@ describe('getUserLanguage', () => {
|
||||
context('request with session', () => {
|
||||
it('uses the user preferred language if avalaible', (done) => {
|
||||
sandbox.stub(User, 'findOne').returns({
|
||||
exec() {
|
||||
exec () {
|
||||
return Q.resolve({
|
||||
preferences: {
|
||||
language: 'it',
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} 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;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
res.respond(403, {field: 1});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user