mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
Simplify spell tests and test more attributes
This commit is contained in:
parent
6fdfe6c3bf
commit
3f6be30ebc
5 changed files with 41 additions and 66 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue