diff --git a/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js b/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js index 56c6a0a940..78a9d0d4b8 100644 --- a/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js +++ b/test/api/v3/integration/user/POST-user_class_cast_spellId.test.js @@ -161,6 +161,23 @@ describe('POST /user/class/cast/:spellId', () => { }); }); + it('Issue #12361: returns an error if stealth has already been cast', async () => { + await user.update({ + 'stats.class': 'rogue', + 'stats.lvl': 15, + 'stats.mp': 400, + 'stats.buffs.stealth': 1, + }); + await user.sync(); + await expect(user.post('/user/class/cast/stealth')) + .to.eventually.be.rejected.and.eql({ + code: 400, + error: 'BadRequest', + message: t('spellAlreadyCast'), + }); + expect(user.stats.mp).to.equal(400); + }); + it('returns an error if targeted party member doesn\'t exist', async () => { const { groupLeader } = await createAndPopulateGroup({ groupDetails: { type: 'party', privacy: 'private' }, diff --git a/test/common/ops/spells.js b/test/common/ops/spells.js index 939b7caab5..1f185c37f2 100644 --- a/test/common/ops/spells.js +++ b/test/common/ops/spells.js @@ -4,6 +4,7 @@ import { import spells from '../../../website/common/script/content/spells'; import { NotAuthorized, + BadRequest, } from '../../../website/common/script/libs/errors'; import i18n from '../../../website/common/script/i18n'; @@ -25,7 +26,7 @@ describe('shared.ops.spells', () => { const spell = spells.healer.heal; try { - spell.cast(user); + spell.cast(user, null, { language: 'en' }); } catch (err) { expect(err).to.be.an.instanceof(NotAuthorized); expect(err.message).to.equal(i18n.t('messageHealthAlreadyMax')); @@ -35,4 +36,22 @@ describe('shared.ops.spells', () => { done(); } }); + + it('Issue #12361: returns an error if chilling frost has already been cast', done => { + user.stats.class = 'wizard'; + user.stats.lvl = 15; + user.stats.mp = 400; + user.stats.buffs.streaks = true; + + const spell = spells.wizard.frost; + try { + spell.cast(user, null, { language: 'en' }); + } catch (err) { + expect(err).to.be.an.instanceof(BadRequest); + expect(err.message).to.equal(i18n.t('spellAlreadyCast')); + expect(user.stats.mp).to.eql(400); + + done(); + } + }); }); diff --git a/website/client/src/components/tasks/spells.vue b/website/client/src/components/tasks/spells.vue index 481539a9d6..216e85c613 100644 --- a/website/client/src/components/tasks/spells.vue +++ b/website/client/src/components/tasks/spells.vue @@ -42,12 +42,14 @@ :key="key" v-b-popover.hover.auto="skillNotes(skill)" class="col-12 col-md-3" - @click="castStart(skill)" + @click="!spellDisabled(key) ? castStart(skill) : null" > -