diff --git a/test/content/spells.js b/test/content/spells.js index a799eced14..0dfb42b73b 100644 --- a/test/content/spells.js +++ b/test/content/spells.js @@ -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); + }); + }); +} diff --git a/test/content/spells/healer.js b/test/content/spells/healer.js deleted file mode 100644 index 9b7573e2e8..0000000000 --- a/test/content/spells/healer.js +++ /dev/null @@ -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); - }); - }); - }); -}); diff --git a/test/content/spells/rogue.js b/test/content/spells/rogue.js deleted file mode 100644 index 37aae0a1db..0000000000 --- a/test/content/spells/rogue.js +++ /dev/null @@ -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); - }); - }); - }); -}); diff --git a/test/content/spells/warrior.js b/test/content/spells/warrior.js deleted file mode 100644 index b57a6c9a8d..0000000000 --- a/test/content/spells/warrior.js +++ /dev/null @@ -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); - }); - }); - }); -}); diff --git a/test/content/spells/wizard.js b/test/content/spells/wizard.js deleted file mode 100644 index 087a61768e..0000000000 --- a/test/content/spells/wizard.js +++ /dev/null @@ -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); - }); - }); - }); -});