mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
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);
|
|
});
|
|
});
|
|
}
|