mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
Simplify spell tests and test more attributes
This commit is contained in:
@@ -1,3 +1,42 @@
|
||||
describe('Spells Locales', () => {
|
||||
runTestsInDirectory('spells');
|
||||
import spells from '../../common/script/src/content/spells';
|
||||
import {each} from 'lodash';
|
||||
|
||||
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,16 +0,0 @@
|
||||
import spells from '../../../common/script/src/content/spells/healer';
|
||||
import {each} from 'lodash';
|
||||
|
||||
describe('Healer Spells', () => {
|
||||
each(spells, (spell, key) => {
|
||||
describe(`${key} Spell`, () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(spell.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(spell.notes);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import spells from '../../../common/script/src/content/spells/rogue';
|
||||
import {each} from 'lodash';
|
||||
|
||||
describe('Rogue Spells', () => {
|
||||
each(spells, (spell, key) => {
|
||||
describe(`${key} Spell`, () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(spell.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(spell.notes);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import spells from '../../../common/script/src/content/spells/warrior';
|
||||
import {each} from 'lodash';
|
||||
|
||||
describe('Warrior Spells', () => {
|
||||
each(spells, (spell, key) => {
|
||||
describe(`${key} Spell`, () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(spell.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(spell.notes);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import spells from '../../../common/script/src/content/spells/wizard';
|
||||
import {each} from 'lodash';
|
||||
|
||||
describe('Mage Spells', () => {
|
||||
each(spells, (spell, key) => {
|
||||
describe(`${key} Spell`, () => {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(spell.text);
|
||||
});
|
||||
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(spell.notes);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user