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

@@ -7,12 +7,12 @@ import {
import * as eggs from '../../website/common/script/content/eggs';
describe('eggs', () => {
describe('all', () => {
describe('eggs', () => {
describe('all', () => {
it('is a combination of drop and quest eggs', () => {
let dropNumber = Object.keys(eggs.drops).length;
let questNumber = Object.keys(eggs.quests).length;
let allNumber = Object.keys(eggs.all).length;
const dropNumber = Object.keys(eggs.drops).length;
const questNumber = Object.keys(eggs.quests).length;
const allNumber = Object.keys(eggs.all).length;
expect(allNumber).to.be.greaterThan(0);
expect(allNumber).to.equal(dropNumber + questNumber);

View File

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

View File

@@ -1,8 +1,8 @@
/* eslint-disable camelcase */
import { each, camelCase } from 'lodash';
import {
expectValidTranslationString,
} from '../helpers/content.helper';
import { each, camelCase } from 'lodash';
import gearData from '../../website/common/script/content/gear';
import * as backerGear from '../../website/common/script/content/gear/sets/special/special-backer';
@@ -16,7 +16,7 @@ describe('Gear', () => {
each(piece, (items, klass) => {
context(`${klass} ${gearType}s`, () => {
it('have a value of at least 0 for each stat', () => {
each(items, (gear) => {
each(items, gear => {
expect(gear.con).to.be.at.least(0);
expect(gear.int).to.be.at.least(0);
expect(gear.per).to.be.at.least(0);
@@ -25,26 +25,26 @@ describe('Gear', () => {
});
it('have a purchase value of at least 0', () => {
each(items, (gear) => {
each(items, gear => {
expect(gear.value).to.be.at.least(0);
});
});
it('has a canBuy function', () => {
each(items, (gear) => {
each(items, gear => {
expect(gear.canBuy).to.be.a('function');
});
});
it('have valid translation strings for text and notes', () => {
each(items, (gear) => {
each(items, gear => {
expectValidTranslationString(gear.text);
expectValidTranslationString(gear.notes);
});
});
it('has a set attribue', () => {
each(items, (gear) => {
each(items, gear => {
expect(gear.set).to.exist;
});
});
@@ -63,7 +63,7 @@ describe('Gear', () => {
};
});
let cases = {
const cases = {
armor_special_0: 45,
armor_special_2: 300,
head_special_0: 45,
@@ -75,7 +75,7 @@ describe('Gear', () => {
each(cases, (tierRequirement, key) => {
context(key, () => {
let camelCaseKey = camelCase(key);
const camelCaseKey = camelCase(key);
it(`canOwn returns true if user has a backer tier of ${tierRequirement} or higher`, () => {
user.backer.tier = tierRequirement;
@@ -112,7 +112,7 @@ describe('Gear', () => {
};
});
let cases = {
const cases = {
armor_special_1: 2,
head_special_1: 3,
shield_special_1: 5,
@@ -121,7 +121,7 @@ describe('Gear', () => {
each(cases, (tierRequirement, key) => {
context(key, () => {
let camelCaseKey = camelCase(key);
const camelCaseKey = camelCase(key);
it(`canOwn returns true if user has a contributor tier of ${tierRequirement} or higher`, () => {
user.contributor.level = tierRequirement;

View File

@@ -7,13 +7,13 @@ import {
import * as hatchingPotions from '../../website/common/script/content/hatching-potions';
describe('hatchingPotions', () => {
describe('all', () => {
describe('hatchingPotions', () => {
describe('all', () => {
it('is a combination of drop, premium, and wacky potions', () => {
let dropNumber = Object.keys(hatchingPotions.drops).length;
let premiumNumber = Object.keys(hatchingPotions.premium).length;
let wackyNumber = Object.keys(hatchingPotions.wacky).length;
let allNumber = Object.keys(hatchingPotions.all).length;
const dropNumber = Object.keys(hatchingPotions.drops).length;
const premiumNumber = Object.keys(hatchingPotions.premium).length;
const wackyNumber = Object.keys(hatchingPotions.wacky).length;
const allNumber = Object.keys(hatchingPotions.all).length;
expect(allNumber).to.be.greaterThan(0);
expect(allNumber).to.equal(dropNumber + premiumNumber + wackyNumber);

View File

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

View File

@@ -10,13 +10,13 @@ import * as stable from '../../website/common/script/content/stable';
import * as eggs from '../../website/common/script/content/eggs';
import * as potions from '../../website/common/script/content/hatching-potions';
describe('stable', () => {
describe('stable', () => {
describe('dropPets', () => {
it('contains a pet for each drop potion * each drop egg', () => {
let numberOfDropPotions = Object.keys(potions.drops).length;
let numberOfDropEggs = Object.keys(eggs.drops).length;
let numberOfDropPets = Object.keys(stable.dropPets).length;
let expectedTotal = numberOfDropPotions * numberOfDropEggs;
const numberOfDropPotions = Object.keys(potions.drops).length;
const numberOfDropEggs = Object.keys(eggs.drops).length;
const numberOfDropPets = Object.keys(stable.dropPets).length;
const expectedTotal = numberOfDropPotions * numberOfDropEggs;
expect(numberOfDropPets).to.be.greaterThan(0);
expect(numberOfDropPets).to.equal(expectedTotal);
@@ -25,10 +25,10 @@ describe('stable', () => {
describe('questPets', () => {
it('contains a pet for each drop potion * each quest egg', () => {
let numberOfDropPotions = Object.keys(potions.drops).length;
let numberOfQuestEggs = Object.keys(eggs.quests).length;
let numberOfQuestPets = Object.keys(stable.questPets).length;
let expectedTotal = numberOfDropPotions * numberOfQuestEggs;
const numberOfDropPotions = Object.keys(potions.drops).length;
const numberOfQuestEggs = Object.keys(eggs.quests).length;
const numberOfQuestPets = Object.keys(stable.questPets).length;
const expectedTotal = numberOfDropPotions * numberOfQuestEggs;
expect(numberOfQuestPets).to.be.greaterThan(0);
expect(numberOfQuestPets).to.equal(expectedTotal);
@@ -37,10 +37,10 @@ describe('stable', () => {
describe('premiumPets', () => {
it('contains a pet for each premium potion * each drop egg', () => {
let numberOfPremiumPotions = Object.keys(potions.premium).length;
let numberOfDropEggs = Object.keys(eggs.drops).length;
let numberOfPremiumPets = Object.keys(stable.premiumPets).length;
let expectedTotal = numberOfPremiumPotions * numberOfDropEggs;
const numberOfPremiumPotions = Object.keys(potions.premium).length;
const numberOfDropEggs = Object.keys(eggs.drops).length;
const numberOfPremiumPets = Object.keys(stable.premiumPets).length;
const expectedTotal = numberOfPremiumPotions * numberOfDropEggs;
expect(numberOfPremiumPets).to.be.greaterThan(0);
expect(numberOfPremiumPets).to.equal(expectedTotal);
@@ -49,10 +49,10 @@ describe('stable', () => {
describe('wackyPets', () => {
it('contains a pet for each wacky potion * each drop egg', () => {
let numberOfWackyPotions = Object.keys(potions.wacky).length;
let numberOfDropEggs = Object.keys(eggs.drops).length;
let numberOfWackyPets = Object.keys(stable.wackyPets).length;
let expectedTotal = numberOfWackyPotions * numberOfDropEggs;
const numberOfWackyPotions = Object.keys(potions.wacky).length;
const numberOfDropEggs = Object.keys(eggs.drops).length;
const numberOfWackyPets = Object.keys(stable.wackyPets).length;
const expectedTotal = numberOfWackyPotions * numberOfDropEggs;
expect(numberOfWackyPets).to.be.greaterThan(0);
expect(numberOfWackyPets).to.equal(expectedTotal);
@@ -61,8 +61,8 @@ describe('stable', () => {
describe('specialPets', () => {
it('each value is a valid translation string', () => {
each(stable.specialPets, (pet) => {
let string = t(pet);
each(stable.specialPets, pet => {
const string = t(pet);
expectValidTranslationString(string);
});
});
@@ -70,10 +70,10 @@ describe('stable', () => {
describe('dropMounts', () => {
it('contains a mount for each drop potion * each drop egg', () => {
let numberOfDropPotions = Object.keys(potions.drops).length;
let numberOfDropEggs = Object.keys(eggs.drops).length;
let numberOfDropMounts = Object.keys(stable.dropMounts).length;
let expectedTotal = numberOfDropPotions * numberOfDropEggs;
const numberOfDropPotions = Object.keys(potions.drops).length;
const numberOfDropEggs = Object.keys(eggs.drops).length;
const numberOfDropMounts = Object.keys(stable.dropMounts).length;
const expectedTotal = numberOfDropPotions * numberOfDropEggs;
expect(numberOfDropMounts).to.be.greaterThan(0);
expect(numberOfDropMounts).to.equal(expectedTotal);
@@ -82,10 +82,10 @@ describe('stable', () => {
describe('questMounts', () => {
it('contains a mount for each drop potion * each quest egg', () => {
let numberOfDropPotions = Object.keys(potions.drops).length;
let numberOfQuestEggs = Object.keys(eggs.quests).length;
let numberOfQuestMounts = Object.keys(stable.questMounts).length;
let expectedTotal = numberOfDropPotions * numberOfQuestEggs;
const numberOfDropPotions = Object.keys(potions.drops).length;
const numberOfQuestEggs = Object.keys(eggs.quests).length;
const numberOfQuestMounts = Object.keys(stable.questMounts).length;
const expectedTotal = numberOfDropPotions * numberOfQuestEggs;
expect(numberOfQuestMounts).to.be.greaterThan(0);
expect(numberOfQuestMounts).to.equal(expectedTotal);
@@ -94,10 +94,10 @@ describe('stable', () => {
describe('premiumMounts', () => {
it('contains a mount for each premium potion * each drop egg', () => {
let numberOfPremiumPotions = Object.keys(potions.premium).length;
let numberOfDropEggs = Object.keys(eggs.drops).length;
let numberOfPremiumMounts = Object.keys(stable.premiumMounts).length;
let expectedTotal = numberOfPremiumPotions * numberOfDropEggs;
const numberOfPremiumPotions = Object.keys(potions.premium).length;
const numberOfDropEggs = Object.keys(eggs.drops).length;
const numberOfPremiumMounts = Object.keys(stable.premiumMounts).length;
const expectedTotal = numberOfPremiumPotions * numberOfDropEggs;
expect(numberOfPremiumMounts).to.be.greaterThan(0);
expect(numberOfPremiumMounts).to.equal(expectedTotal);
@@ -106,24 +106,26 @@ describe('stable', () => {
describe('specialMounts', () => {
it('each value is a valid translation string', () => {
each(stable.specialMounts, (mount) => {
let string = t(mount);
each(stable.specialMounts, mount => {
const string = t(mount);
expectValidTranslationString(string);
});
});
});
describe('petInfo', () => {
describe('petInfo', () => {
it('contains an entry for all pets', () => {
let dropNumber = Object.keys(stable.dropPets).length;
let questNumber = Object.keys(stable.questPets).length;
let specialNumber = Object.keys(stable.specialPets).length;
let premiumNumber = Object.keys(stable.premiumPets).length;
let wackyNumber = Object.keys(stable.wackyPets).length;
let allNumber = Object.keys(stable.petInfo).length;
const dropNumber = Object.keys(stable.dropPets).length;
const questNumber = Object.keys(stable.questPets).length;
const specialNumber = Object.keys(stable.specialPets).length;
const premiumNumber = Object.keys(stable.premiumPets).length;
const wackyNumber = Object.keys(stable.wackyPets).length;
const allNumber = Object.keys(stable.petInfo).length;
expect(allNumber).to.be.greaterThan(0);
expect(allNumber).to.equal(dropNumber + questNumber + specialNumber + premiumNumber + wackyNumber);
expect(allNumber).to.equal(
dropNumber + questNumber + specialNumber + premiumNumber + wackyNumber,
);
});
it('contains basic information about each pet', () => {
@@ -135,13 +137,13 @@ describe('stable', () => {
});
});
describe('mountInfo', () => {
describe('mountInfo', () => {
it('contains an entry for all mounts', () => {
let dropNumber = Object.keys(stable.dropMounts).length;
let questNumber = Object.keys(stable.questMounts).length;
let specialNumber = Object.keys(stable.specialMounts).length;
let premiumNumber = Object.keys(stable.premiumMounts).length;
let allNumber = Object.keys(stable.mountInfo).length;
const dropNumber = Object.keys(stable.dropMounts).length;
const questNumber = Object.keys(stable.questMounts).length;
const specialNumber = Object.keys(stable.specialMounts).length;
const premiumNumber = Object.keys(stable.premiumMounts).length;
const allNumber = Object.keys(stable.mountInfo).length;
expect(allNumber).to.be.greaterThan(0);
expect(allNumber).to.equal(dropNumber + questNumber + specialNumber + premiumNumber);

View File

@@ -1,14 +1,14 @@
import {STRING_ERROR_MSG, STRING_DOES_NOT_EXIST_MSG} from '../helpers/content.helper';
import { STRING_ERROR_MSG, STRING_DOES_NOT_EXIST_MSG } from '../helpers/content.helper';
import translator from '../../website/common/script/content/translation';
describe('Translator', () => {
it('returns error message if string is not properly formatted', () => {
let improperlyFormattedString = translator('petName', {attr: 0})();
const improperlyFormattedString = translator('petName', { attr: 0 })();
expect(improperlyFormattedString).to.match(STRING_ERROR_MSG);
});
it('returns an error message if string does not exist', () => {
let stringDoesNotExist = translator('stringDoesNotExist')();
const stringDoesNotExist = translator('stringDoesNotExist')();
expect(stringDoesNotExist).to.match(STRING_DOES_NOT_EXIST_MSG);
});
});