Simplify spell tests and test more attributes

This commit is contained in:
Blade Barringer
2015-10-03 10:21:52 -05:00
parent 6fdfe6c3bf
commit 3f6be30ebc
5 changed files with 41 additions and 66 deletions

View File

@@ -1,3 +1,42 @@
describe('Spells Locales', () => { import spells from '../../common/script/src/content/spells';
runTestsInDirectory('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);
});
});
}

View File

@@ -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);
});
});
});
});

View File

@@ -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);
});
});
});
});

View File

@@ -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);
});
});
});
});

View File

@@ -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);
});
});
});
});