Fix issue with l4p not resetting properly (#15240)

* actually clear out seeking field on user. Even when creating a party

* Add tests to ensure party.seeking is cleared

* fix(lint): don't assign unused const

---------

Co-authored-by: Sabe Jones <sabe@habitica.com>
This commit is contained in:
Phillip Thelen
2024-06-11 00:00:31 +02:00
committed by GitHub
parent 37f08c4534
commit 758b6138c2
3 changed files with 23 additions and 1 deletions

View File

@@ -178,6 +178,15 @@ describe('POST /group/:groupId/join', () => {
await expect(invitedUser.get('/user')).to.eventually.not.have.nested.property('invitations.parties[0].id');
});
it('clears party.seeking from user when joining party', async () => {
await invitedUser.updateOne({ 'party.seeking': new Date() });
await invitedUser.post(`/groups/${party._id}/join`);
const updatedUser = await invitedUser.get('/user');
await expect(updatedUser.party.seeking).to.not.exist;
});
it('increments memberCount when joining party', async () => {
const oldMemberCount = party.memberCount;