Upgrade lodash to v4 and lint more files (#8495)

* common: import lodash modules separately

* remove test/content from .eslintignore, fix with eslint --fix content/index

* lint test/content

* lint content/index except for lodash methods

* upgrade server/models

* upgrade server/middlewares and server/libs

* port server/controllers/top-level

* port server/controllers/api-v3

* port views and tests

* client old port lodash and _(, missing _.

* upgrade client-old

* port common/script (root level files only)

* port common/script/fns

* port common/libs

* port common/script/ops

* port common/script/content and common/script/libs/shops.js

* misc fixes

* misc fixes

* misc fixes

* more tests fixes

* fix payments test stubbing, down to 2 failing tests

* remove more instances of lodash wrapping

* fix bug where toObject does not clone object

* fix tests

* upgrade migration or add lodash 4 note

* update shrinkwrap

* fix linting

* upgrade eslint-config-habitrpg

* update shrinkwrap

* recompile shrinkwrap
This commit is contained in:
Matteo Pagliazzi
2017-03-01 17:10:48 +01:00
committed by GitHub
parent ef02e59590
commit 98c019a0b6
150 changed files with 4996 additions and 1533 deletions

View File

@@ -8,19 +8,19 @@ import {questions, stillNeedHelp} from '../../website/common/script/content/faq'
describe('FAQ Locales', () => {
describe('Questions', () => {
it('has a valid questions', () => {
each(questions, (question, key) => {
each(questions, (question) => {
expectValidTranslationString(question.question);
});
});
it('has a valid ios answers', () => {
each(questions, (question, key) => {
each(questions, (question) => {
expectValidTranslationString(question.ios);
});
});
it('has a valid web answers', () => {
each(questions, (question, key) => {
each(questions, (question) => {
expectValidTranslationString(question.web);
});
});

View File

@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
import {
expectValidTranslationString,
} from '../helpers/content.helper';
@@ -68,7 +69,7 @@ describe('Gear', () => {
weapon_special_0: 70,
weapon_special_2: 300,
weapon_special_3: 300,
}
};
each(cases, (tierRequirement, key) => {
context(key, () => {

View File

@@ -1,13 +1,13 @@
import {each} from 'lodash';
import {
expectValidTranslationString
expectValidTranslationString,
} from '../helpers/content.helper';
import mysterySets from '../../website/common/script/content/mystery-sets';
describe('Mystery Sets', () => {
it('has a valid text string', () => {
each(mysterySets, (set, key) => {
each(mysterySets, (set) => {
expectValidTranslationString(set.text);
});
});

View File

@@ -1,29 +1,28 @@
import _ from 'lodash';
import {
generateUser,
} from '../helpers/common.helper';
import timeTravelers from '../../website/common/script/content/time-travelers'
import timeTravelers from '../../website/common/script/content/time-travelers';
describe('time-travelers store', () => {
let user;
beforeEach(() => {
user = generateUser();
});
let user;
beforeEach(() => {
user = generateUser();
});
it('removes owned sets from the time travelers store', () => {
user.items.gear.owned['head_mystery_201602'] = true;
expect(timeTravelers.timeTravelerStore(user)['201602']).to.not.exist;
expect(timeTravelers.timeTravelerStore(user)['201603']).to.exist;
});
it('removes owned sets from the time travelers store', () => {
user.items.gear.owned.head_mystery_201602 = true; // eslint-disable-line camelcase
expect(timeTravelers.timeTravelerStore(user)['201602']).to.not.exist;
expect(timeTravelers.timeTravelerStore(user)['201603']).to.exist;
});
it('removes unopened mystery item sets from the time travelers store', () => {
user.purchased = {
plan: {
mysteryItems: ['head_mystery_201602'],
},
};
expect(timeTravelers.timeTravelerStore(user)['201602']).to.not.exist;
expect(timeTravelers.timeTravelerStore(user)['201603']).to.exist;
});
it('removes unopened mystery item sets from the time travelers store', () => {
user.purchased = {
plan: {
mysteryItems: ['head_mystery_201602'],
},
};
expect(timeTravelers.timeTravelerStore(user)['201602']).to.not.exist;
expect(timeTravelers.timeTravelerStore(user)['201603']).to.exist;
});
});