mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Clear invites from user when the request fails because the invite is invalid (#7852)
* making requests to accept or reject a request fail because the invite is invalid clear the invite from the user so it doesn't require admin intervention. part of #7653 * Adding await
This commit is contained in:
@@ -74,6 +74,21 @@ describe('POST /groups/:groupId/quests/accept', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('clears the invalid invite from the user when the request fails', async () => {
|
||||
await leader.post(`/groups/${questingGroup._id}/quests/invite/${PET_QUEST}`);
|
||||
await partyMembers[0].post(`/groups/${questingGroup._id}/quests/accept`);
|
||||
|
||||
await expect(partyMembers[0].post(`/groups/${questingGroup._id}/quests/accept`))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('questAlreadyAccepted'),
|
||||
});
|
||||
|
||||
await partyMembers[0].sync();
|
||||
expect(partyMembers[0].party.quest.RSVPNeeded).to.be.false;
|
||||
});
|
||||
|
||||
it('does not accept invite for a quest already underway', async () => {
|
||||
await leader.post(`/groups/${questingGroup._id}/quests/invite/${PET_QUEST}`);
|
||||
await partyMembers[0].post(`/groups/${questingGroup._id}/quests/accept`);
|
||||
|
||||
Reference in New Issue
Block a user