mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Merge #12654
Fixes #12417 Squashed commit of the following: commit 1f074175c480a638cf61e2c72ca57cdc6f8699b6 Author: Matteo Pagliazzi <matteopagliazzi@gmail.com> Date: Mon Oct 26 10:57:23 2020 +0100 fix(i18n): remove unused string questLevelTooHigh commit 12cc74002ec87c14cc000b008454f34475fd3636 Merge:4fc260e552ad9b551de3Author: Matteo Pagliazzi <matteopagliazzi@gmail.com> Date: Mon Oct 26 10:50:39 2020 +0100 Merge branch 'feature/level-locked-quests-should-be-used-at-any-level' of https://github.com/hamboomger/habitica into hamboomger-feature/level-locked-quests-should-be-used-at-any-level commitad9b551de3Author: hamboomger <hamboomger@gmail.com> Date: Thu Oct 8 13:34:19 2020 +0300 fix(quests): Quests that are level-locked for purchase can now be used at any level
This commit is contained in:
@@ -83,22 +83,6 @@ describe('POST /groups/:groupId/quests/invite/:questKey', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not issue invites if the user is of insufficient Level', async () => {
|
||||
const LEVELED_QUEST = 'atom1';
|
||||
const LEVELED_QUEST_REQ = questScrolls[LEVELED_QUEST].lvl;
|
||||
const leaderUpdate = {};
|
||||
leaderUpdate[`items.quests.${LEVELED_QUEST}`] = 1;
|
||||
leaderUpdate['stats.lvl'] = LEVELED_QUEST_REQ - 1;
|
||||
|
||||
await leader.update(leaderUpdate);
|
||||
|
||||
await expect(leader.post(`/groups/${questingGroup._id}/quests/invite/${LEVELED_QUEST}`)).to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('questLevelTooHigh', { level: LEVELED_QUEST_REQ }),
|
||||
});
|
||||
});
|
||||
|
||||
it('does not issue invites if a quest is already underway', async () => {
|
||||
const QUEST_IN_PROGRESS = 'atom1';
|
||||
const leaderUpdate = {};
|
||||
@@ -212,6 +196,18 @@ describe('POST /groups/:groupId/quests/invite/:questKey', () => {
|
||||
expect(returnedGroup.chat[0]._meta).to.be.undefined;
|
||||
});
|
||||
|
||||
it('successfully issues a quest invitation when quest level is higher than user level', async () => {
|
||||
const LEVELED_QUEST = 'atom1';
|
||||
const LEVELED_QUEST_REQ = questScrolls[LEVELED_QUEST].lvl;
|
||||
const leaderUpdate = {};
|
||||
leaderUpdate[`items.quests.${LEVELED_QUEST}`] = 1;
|
||||
leaderUpdate['stats.lvl'] = LEVELED_QUEST_REQ - 1;
|
||||
|
||||
await leader.update(leaderUpdate);
|
||||
|
||||
await leader.post(`/groups/${questingGroup._id}/quests/invite/${LEVELED_QUEST}`);
|
||||
});
|
||||
|
||||
context('sending quest activity webhooks', () => {
|
||||
before(async () => {
|
||||
await server.start();
|
||||
|
||||
Reference in New Issue
Block a user