mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
refactor: Remove unused common script src files
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import armoire from '../../common/script/src/content/armoire';
|
||||
|
||||
describe('Armoire Locales', () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(armoire.text);
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import backgroundSets from '../../common/script/src/content/backgrounds';
|
||||
|
||||
describe('Backgrounds', () => {
|
||||
each(backgroundSets, (set, name) => {
|
||||
describeEachItem(name, set, (bg, key) => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(bg.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(bg.notes);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import {allEggs} from '../../common/script/src/content/eggs';
|
||||
|
||||
describeEachItem('Eggs', allEggs, (egg, key) => {
|
||||
it('has a key attribute', () => {
|
||||
expect(egg.key).to.eql(key);
|
||||
});
|
||||
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(egg.text);
|
||||
});
|
||||
|
||||
it('has a valid mountText attribute', () => {
|
||||
expectValidTranslationString(egg.mountText);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(egg.notes);
|
||||
});
|
||||
|
||||
it('has a valid ajective attribute', () => {
|
||||
expectValidTranslationString(egg.adjective);
|
||||
});
|
||||
|
||||
it('has a canBuy function', () => {
|
||||
expect(egg.canBuy).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a value attribute', () => {
|
||||
expect(egg.value).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
@@ -1,29 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import allFood from '../../common/script/src/content/food';
|
||||
|
||||
describeEachItem('Food', allFood, (food, key) => {
|
||||
it('has a valid key', () => {
|
||||
expect(food.key).to.eql(key);
|
||||
});
|
||||
|
||||
it('has a valid value attribute', () => {
|
||||
expect(food.value).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
it('has a canBuy function', () => {
|
||||
expect(food.canBuy).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(food.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(food.notes);
|
||||
});
|
||||
});
|
||||
@@ -1,29 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import { all as potions } from '../../common/script/src/content/hatching-potions';
|
||||
|
||||
describeEachItem('Hatching Potions', potions, (potion, key) => {
|
||||
it('has a valid key', () => {
|
||||
expect(potion.key).to.eql(key);
|
||||
});
|
||||
|
||||
it('has a canBuy function', () => {
|
||||
expect(potion.canBuy).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(potion.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(potion.notes);
|
||||
});
|
||||
|
||||
it('has a valid value', () => {
|
||||
expect(potion.value).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import healthPotion from '../../common/script/src/content/health-potion';
|
||||
|
||||
describe('Health Potion Locales', () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(healthPotion.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(healthPotion.notes);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import {
|
||||
all as allQuests,
|
||||
byLevel as questsByLevel
|
||||
} from '../../common/script/src/content/quests';
|
||||
|
||||
describeEachItem('Quests', allQuests, (quest, key) => {
|
||||
context('attributes', () => {
|
||||
it('has a key', () => {
|
||||
expect(quest.key).to.eql(key);
|
||||
});
|
||||
|
||||
it('has a category', () => {
|
||||
expect(quest.category).to.not.be.empty;
|
||||
});
|
||||
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(quest.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(quest.notes);
|
||||
});
|
||||
|
||||
if (quest.previous) {
|
||||
it('has a valid previous quest', () => {
|
||||
expect(allQuests[quest.previous]).to.exist;
|
||||
});
|
||||
}
|
||||
|
||||
if (quest.completion) {
|
||||
it('has a valid completion attribute', () => {
|
||||
expectValidTranslationString(quest.completion);
|
||||
});
|
||||
}
|
||||
|
||||
it('has a canBuy function', () => {
|
||||
expect(quest.canBuy).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a value', () => {
|
||||
expect(quest.value).to.be.at.least(0);
|
||||
});
|
||||
});
|
||||
|
||||
if (quest.boss) {
|
||||
context('boss', () => {
|
||||
it('has a valid boss name attribute', () => {
|
||||
expectValidTranslationString(quest.boss.name);
|
||||
});
|
||||
|
||||
it('has an hp attribute', () => {
|
||||
expect(quest.boss.hp).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
it('has a str attribute', () => {
|
||||
expect(quest.boss.str).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
it('has a def attribute', () => {
|
||||
expect(quest.boss.def).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
if (quest.boss.rage) {
|
||||
context('rage', () => {
|
||||
it('has a title attribute', () => {
|
||||
expectValidTranslationString(quest.boss.rage.title);
|
||||
});
|
||||
|
||||
it('has a description attribute', () => {
|
||||
expectValidTranslationString(quest.boss.rage.description);
|
||||
});
|
||||
|
||||
it('has a value attribute', () => {
|
||||
expect(quest.boss.rage.value).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
if (quest.boss.rage.healing) {
|
||||
it('has a healing attribute', () => {
|
||||
expect(quest.boss.rage.healing).to.be.greaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (quest.boss.rage.effect) {
|
||||
it('has an effect attribute', () => {
|
||||
expectValidTranslationString(quest.boss.rage.effect);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (quest.collect) {
|
||||
context('collection', () => {
|
||||
each(quest.collect, (item, key) => {
|
||||
it(`${key} has a valid text attribute`, () => {
|
||||
expectValidTranslationString(item.text);
|
||||
expect(item.count).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
context('drops', () => {
|
||||
it('has drops', () => {
|
||||
expect(quest.drop).to.exist;
|
||||
});
|
||||
|
||||
it('has a gold value', () => {
|
||||
expect(quest.drop.gp).to.be.at.least(0);
|
||||
});
|
||||
|
||||
it('has a exp value', () => {
|
||||
expect(quest.drop.exp).to.be.at.least(0);
|
||||
});
|
||||
|
||||
if (quest.items) {
|
||||
it('has items', () => {
|
||||
expect(quest.drop.items).to.be.an('array');
|
||||
expect(quest.drop.items).to.have.length.above(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('Quests by Level', () => {
|
||||
let lastLevel = 0;
|
||||
|
||||
it('orders quests by level', () => {
|
||||
each(questsByLevel, (quest, key) => {
|
||||
let questLvl = quest.lvl || 0;
|
||||
|
||||
expect(questLvl).to.be.at.least(lastLevel);
|
||||
lastLevel = questLvl;
|
||||
});
|
||||
|
||||
expect(lastLevel).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import spells from '../../common/script/src/content/spells';
|
||||
|
||||
describe('Spells', () => {
|
||||
each(spells, (spellSet, klass) => {
|
||||
describeEachItem(klass, spellSet, (spell, key) => {
|
||||
checkSpellAttributes(spell, key);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function checkSpellAttributes(spell, key) {
|
||||
describe(`${key}`, () => {
|
||||
it('has a key attribute', () => {
|
||||
expect(spell.key).to.eql(key);
|
||||
});
|
||||
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(spell.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(spell.notes);
|
||||
});
|
||||
|
||||
it('has a cast function', () => {
|
||||
expect(spell.cast).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a mana attribute', () => {
|
||||
expect(spell.mana).to.be.at.least(0);
|
||||
});
|
||||
|
||||
it('has a valid target attribute', () => {
|
||||
expect(spell.target).to.match(/self|user|party|task/);
|
||||
});
|
||||
|
||||
it('has a mana attribute', () => {
|
||||
expect(spell.mana).to.be.at.least(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import {STRING_ERROR_MSG, STRING_DOES_NOT_EXIST_MSG} from '../helpers/content.helper';
|
||||
import {translator} from '../../common/script/src/content/helpers';
|
||||
import translator from '../../common/script/content/translation';
|
||||
|
||||
describe('Translator', () => {
|
||||
it('returns error message if string is not properly formatted', () => {
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import {
|
||||
habits,
|
||||
dailys,
|
||||
todos,
|
||||
rewards,
|
||||
tags
|
||||
} from '../../common/script/src/content/user-defaults';
|
||||
|
||||
describe('User Defaults', () => {
|
||||
let tasks = {
|
||||
habits: habits,
|
||||
dailys: dailys,
|
||||
todos: todos,
|
||||
rewards: rewards
|
||||
};
|
||||
|
||||
describeEachItem('Tasks', tasks, (type, name) => {
|
||||
each(type, (task, index) => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(task.text);
|
||||
});
|
||||
|
||||
it('has a valid type attribute', () => {
|
||||
expect(task.type).to.match(/todo|daily|habit|reward/);
|
||||
});
|
||||
|
||||
if (task.notes) {
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(task.notes);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describeEachItem('Tags', tags, (tag, index) => {
|
||||
|
||||
it('has a valid name attribute', () => {
|
||||
expectValidTranslationString(tag.name);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user