mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
* Fixing healing light not being castable on server and client sides when user has already full health Adding integration test for spell cast of healing light when full health Adding test for heal cast if user has full health * Fixing ESLint syntax in the spells test files
38 lines
938 B
JavaScript
38 lines
938 B
JavaScript
import {
|
|
generateUser,
|
|
} from '../../helpers/common.helper';
|
|
import spells from '../../../website/common/script/content/spells';
|
|
import {
|
|
NotAuthorized,
|
|
} from '../../../website/common/script/libs/errors';
|
|
import i18n from '../../../website/common/script/i18n';
|
|
|
|
// TODO complete the test suite...
|
|
|
|
describe('shared.ops.spells', () => {
|
|
let user;
|
|
|
|
beforeEach(() => {
|
|
user = generateUser();
|
|
});
|
|
|
|
it('returns an error when healer tries to cast Healing Light with full health', (done) => {
|
|
user.stats.class = 'healer';
|
|
user.stats.lvl = 11;
|
|
user.stats.hp = 50;
|
|
user.stats.mp = 200;
|
|
|
|
let spell = spells.healer.heal;
|
|
|
|
try {
|
|
spell.cast(user);
|
|
} catch (err) {
|
|
expect(err).to.be.an.instanceof(NotAuthorized);
|
|
expect(err.message).to.equal(i18n.t('messageHealthAlreadyMax'));
|
|
expect(user.stats.hp).to.eql(50);
|
|
expect(user.stats.mp).to.eql(200);
|
|
|
|
done();
|
|
}
|
|
});
|
|
}); |