mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Upgrade tests tools and lint migrations and scripts (part 2) (#9998)
* upgrade gulp-babel * upgrade babel-eslint * upgrade eslint-friendly-formatter * start upgrading chai * start to upgrade eslint * restore skipped tests * start to upgrqde monk * fix linting and remove unused file * fix mocha notifications, and common tests * fix unit tests * start to fix initrgration tests * more integration tests fixes * upgrade monk to latest version * lint /scripts * migrations: start moving to /archive unused migrations and run eslint with --fix * lint migrations * fix more integration tests * fix test
This commit is contained in:
@@ -93,14 +93,14 @@ describe('GET /groups', () => {
|
||||
it('returns only the tavern when tavern passed in as query', async () => {
|
||||
await expect(user.get('/groups?type=tavern'))
|
||||
.to.eventually.have.a.lengthOf(1)
|
||||
.and.to.have.deep.property('[0]')
|
||||
.and.to.have.nested.property('[0]')
|
||||
.and.to.have.property('_id', TAVERN_ID);
|
||||
});
|
||||
|
||||
it('returns only the user\'s party when party passed in as query', async () => {
|
||||
await expect(user.get('/groups?type=party'))
|
||||
.to.eventually.have.a.lengthOf(1)
|
||||
.and.to.have.deep.property('[0]');
|
||||
.and.to.have.nested.property('[0]');
|
||||
});
|
||||
|
||||
it('returns all public guilds when publicGuilds passed in as query', async () => {
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
|
||||
await joiningUser.post(`/groups/${publicGuild._id}/join`);
|
||||
|
||||
await expect(joiningUser.get(`/groups/${publicGuild._id}`)).to.eventually.have.deep.property('leader._id', joiningUser._id);
|
||||
await expect(joiningUser.get(`/groups/${publicGuild._id}`)).to.eventually.have.nested.property('leader._id', joiningUser._id);
|
||||
});
|
||||
|
||||
it('increments memberCount when joining guilds', async () => {
|
||||
@@ -72,7 +72,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('awards Joined Guild achievement', async () => {
|
||||
await joiningUser.post(`/groups/${publicGuild._id}/join`);
|
||||
|
||||
await expect(joiningUser.get('/user')).to.eventually.have.deep.property('achievements.joinedGuild', true);
|
||||
await expect(joiningUser.get('/user')).to.eventually.have.nested.property('achievements.joinedGuild', true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
await invitedUser.post(`/groups/${guild._id}/join`);
|
||||
|
||||
await expect(invitedUser.get('/user'))
|
||||
.to.eventually.have.deep.property('invitations.guilds')
|
||||
.to.eventually.have.nested.property('invitations.guilds')
|
||||
.to.not.include({id: guild._id});
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('does not give basilist quest to inviter when joining a guild', async () => {
|
||||
await invitedUser.post(`/groups/${guild._id}/join`);
|
||||
|
||||
await expect(user.get('/user')).to.eventually.not.have.deep.property('items.quests.basilist');
|
||||
await expect(user.get('/user')).to.eventually.not.have.nested.property('items.quests.basilist');
|
||||
});
|
||||
|
||||
it('does not increment basilist quest count to inviter with basilist when joining a guild', async () => {
|
||||
@@ -138,7 +138,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
|
||||
await invitedUser.post(`/groups/${guild._id}/join`);
|
||||
|
||||
await expect(user.get('/user')).to.eventually.have.deep.property('items.quests.basilist', 1);
|
||||
await expect(user.get('/user')).to.eventually.have.nested.property('items.quests.basilist', 1);
|
||||
});
|
||||
|
||||
it('notifies inviting user that their invitation was accepted', async () => {
|
||||
@@ -160,7 +160,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('awards Joined Guild achievement', async () => {
|
||||
await invitedUser.post(`/groups/${guild._id}/join`);
|
||||
|
||||
await expect(invitedUser.get('/user')).to.eventually.have.deep.property('achievements.joinedGuild', true);
|
||||
await expect(invitedUser.get('/user')).to.eventually.have.nested.property('achievements.joinedGuild', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -197,7 +197,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('allows invited user to join party', async () => {
|
||||
await invitedUser.post(`/groups/${party._id}/join`);
|
||||
|
||||
await expect(invitedUser.get('/user')).to.eventually.have.deep.property('party._id', party._id);
|
||||
await expect(invitedUser.get('/user')).to.eventually.have.nested.property('party._id', party._id);
|
||||
});
|
||||
|
||||
it('notifies inviting user that their invitation was accepted', async () => {
|
||||
@@ -220,7 +220,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('clears invitation from user when joining party', async () => {
|
||||
await invitedUser.post(`/groups/${party._id}/join`);
|
||||
|
||||
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.parties[0].id');
|
||||
await expect(invitedUser.get('/user')).to.eventually.not.have.nested.property('invitations.parties[0].id');
|
||||
});
|
||||
|
||||
it('increments memberCount when joining party', async () => {
|
||||
@@ -234,7 +234,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
it('gives basilist quest item to the inviter when joining a party', async () => {
|
||||
await invitedUser.post(`/groups/${party._id}/join`);
|
||||
|
||||
await expect(user.get('/user')).to.eventually.have.deep.property('items.quests.basilist', 1);
|
||||
await expect(user.get('/user')).to.eventually.have.nested.property('items.quests.basilist', 1);
|
||||
});
|
||||
|
||||
it('increments basilist quest item count to inviter when joining a party', async () => {
|
||||
@@ -242,7 +242,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
|
||||
await invitedUser.post(`/groups/${party._id}/join`);
|
||||
|
||||
await expect(user.get('/user')).to.eventually.have.deep.property('items.quests.basilist', 2);
|
||||
await expect(user.get('/user')).to.eventually.have.nested.property('items.quests.basilist', 2);
|
||||
});
|
||||
|
||||
it('deletes previous party where the user was the only member', async () => {
|
||||
@@ -258,7 +258,7 @@ describe('POST /group/:groupId/join', () => {
|
||||
});
|
||||
await userToInvite.post(`/groups/${party._id}/join`);
|
||||
|
||||
await expect(user.get('/user')).to.eventually.have.deep.property('party._id', party._id);
|
||||
await expect(user.get('/user')).to.eventually.have.nested.property('party._id', party._id);
|
||||
await expect(checkExistence('groups', oldParty._id)).to.eventually.equal(false);
|
||||
});
|
||||
|
||||
@@ -273,8 +273,8 @@ describe('POST /group/:groupId/join', () => {
|
||||
await invitedUser.sync();
|
||||
await party.sync();
|
||||
|
||||
expect(invitedUser).to.have.deep.property('party.quest.RSVPNeeded', true);
|
||||
expect(invitedUser).to.have.deep.property('party.quest.key', party.quest.key);
|
||||
expect(invitedUser).to.have.nested.property('party.quest.RSVPNeeded', true);
|
||||
expect(invitedUser).to.have.nested.property('party.quest.key', party.quest.key);
|
||||
expect(party.quest.members[invitedUser._id]).to.be.null;
|
||||
});
|
||||
});
|
||||
@@ -300,16 +300,16 @@ describe('POST /group/:groupId/join', () => {
|
||||
await member.sync();
|
||||
await leader.sync();
|
||||
|
||||
expect(member).to.have.deep.property('achievements.partyUp', true);
|
||||
expect(leader).to.have.deep.property('achievements.partyUp', true);
|
||||
expect(member).to.have.nested.property('achievements.partyUp', true);
|
||||
expect(leader).to.have.nested.property('achievements.partyUp', true);
|
||||
});
|
||||
|
||||
it('does not award Party On achievement to party of size 2', async () => {
|
||||
await member.sync();
|
||||
await leader.sync();
|
||||
|
||||
expect(member).to.not.have.deep.property('achievements.partyOn');
|
||||
expect(leader).to.not.have.deep.property('achievements.partyOn');
|
||||
expect(member).to.not.have.nested.property('achievements.partyOn');
|
||||
expect(leader).to.not.have.nested.property('achievements.partyOn');
|
||||
});
|
||||
|
||||
it('awards Party On achievement to party of size 4', async () => {
|
||||
@@ -324,8 +324,8 @@ describe('POST /group/:groupId/join', () => {
|
||||
await member.sync();
|
||||
await leader.sync();
|
||||
|
||||
expect(member).to.have.deep.property('achievements.partyOn', true);
|
||||
expect(leader).to.have.deep.property('achievements.partyOn', true);
|
||||
expect(member).to.have.nested.property('achievements.partyOn', true);
|
||||
expect(leader).to.have.nested.property('achievements.partyOn', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ describe('POST /groups/:groupId/leave', () => {
|
||||
expect(leader.notifications.find(n => {
|
||||
return n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === groupToLeave._id;
|
||||
})).to.not.exist;
|
||||
expect(leader.newMessages[groupToLeave._id]).to.be.empty;
|
||||
expect(leader.newMessages[groupToLeave._id]).to.be.undefined;
|
||||
});
|
||||
|
||||
context('with challenges', () => {
|
||||
@@ -257,7 +257,7 @@ describe('POST /groups/:groupId/leave', () => {
|
||||
|
||||
let userWithoutInvitation = await invitedUser.get('/user');
|
||||
|
||||
expect(userWithoutInvitation.invitations.parties[0]).to.be.empty;
|
||||
expect(userWithoutInvitation.invitations.parties[0]).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('POST /group/:groupId/reject-invite', () => {
|
||||
await invitedUser.post(`/groups/${publicGuild._id}/reject-invite`);
|
||||
|
||||
await expect(invitedUser.get('/user'))
|
||||
.to.eventually.have.deep.property('invitations.guilds')
|
||||
.to.eventually.have.nested.property('invitations.guilds')
|
||||
.to.not.include({id: publicGuild._id});
|
||||
});
|
||||
});
|
||||
@@ -72,7 +72,7 @@ describe('POST /group/:groupId/reject-invite', () => {
|
||||
await invitedUser.post(`/groups/${guild._id}/reject-invite`);
|
||||
|
||||
await expect(invitedUser.get('/user'))
|
||||
.to.eventually.have.deep.property('invitations.guilds')
|
||||
.to.eventually.have.nested.property('invitations.guilds')
|
||||
.to.not.include({id: guild._id});
|
||||
});
|
||||
});
|
||||
@@ -107,7 +107,7 @@ describe('POST /group/:groupId/reject-invite', () => {
|
||||
it('clears invitation from user', async () => {
|
||||
await invitedUser.post(`/groups/${party._id}/reject-invite`);
|
||||
|
||||
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.parties[0].id');
|
||||
await expect(invitedUser.get('/user')).to.eventually.not.have.nested.property('invitations.parties[0].id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -184,7 +184,7 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
|
||||
|
||||
let invitedUserWithoutInvite = await partyInvitedUser.get('/user');
|
||||
|
||||
expect(invitedUserWithoutInvite.invitations.parties[0]).to.be.empty;
|
||||
expect(invitedUserWithoutInvite.invitations.parties[0]).to.be.undefined;
|
||||
});
|
||||
|
||||
it('removes new messages from a member who is removed', async () => {
|
||||
@@ -203,7 +203,7 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
|
||||
expect(removedMember.notifications.find(n => {
|
||||
return n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === party._id;
|
||||
})).to.not.exist;
|
||||
expect(removedMember.newMessages[party._id]).to.be.empty;
|
||||
expect(removedMember.newMessages[party._id]).to.be.undefined;
|
||||
});
|
||||
|
||||
it('removes user from quest when removing user from party after quest starts', async () => {
|
||||
|
||||
@@ -30,22 +30,22 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [fakeID],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when inviting yourself to a group', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [inviter._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('cannotInviteSelfToGroup'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('cannotInviteSelfToGroup'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when uuids is not an array', async () => {
|
||||
@@ -54,11 +54,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: {fakeID},
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('uuidsMustBeAnArray'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('uuidsMustBeAnArray'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when uuids and emails are empty', async () => {
|
||||
@@ -66,22 +66,22 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
emails: [],
|
||||
uuids: [],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMustNotBeEmpty'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMustNotBeEmpty'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when uuids is empty and emails is not passed', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingUuid'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingUuid'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT uuids', async () => {
|
||||
@@ -94,11 +94,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids,
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
});
|
||||
|
||||
it('invites a user to a group by uuid', async () => {
|
||||
@@ -114,7 +114,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
}]);
|
||||
|
||||
await expect(userToInvite.get('/user'))
|
||||
.to.eventually.have.deep.property('invitations.guilds[0].id', group._id);
|
||||
.to.eventually.have.nested.property('invitations.guilds[0].id', group._id);
|
||||
});
|
||||
|
||||
it('invites multiple users to a group by uuid', async () => {
|
||||
@@ -138,8 +138,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
},
|
||||
]);
|
||||
|
||||
await expect(userToInvite.get('/user')).to.eventually.have.deep.property('invitations.guilds[0].id', group._id);
|
||||
await expect(userToInvite2.get('/user')).to.eventually.have.deep.property('invitations.guilds[0].id', group._id);
|
||||
await expect(userToInvite.get('/user')).to.eventually.have.nested.property('invitations.guilds[0].id', group._id);
|
||||
await expect(userToInvite2.get('/user')).to.eventually.have.nested.property('invitations.guilds[0].id', group._id);
|
||||
});
|
||||
|
||||
it('returns an error when inviting multiple users and a user is not found', async () => {
|
||||
@@ -149,11 +149,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id, fakeID],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -164,33 +164,33 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [{name: 'test'}],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingEmail'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingEmail'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when emails is not an array', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: {testInvite},
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('emailsMustBeAnArray'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('emailsMustBeAnArray'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when emails is empty and uuids is not passed', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingEmail'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('inviteMissingEmail'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT emails', async () => {
|
||||
@@ -203,11 +203,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails,
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when a user has sent the max number of email invites', async () => {
|
||||
@@ -224,11 +224,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
emails: [testInvite],
|
||||
inviter: 'inviter name',
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('inviteLimitReached', {techAssistanceEmail: nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL')}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('inviteLimitReached', {techAssistanceEmail: nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL')}),
|
||||
});
|
||||
});
|
||||
|
||||
it('invites a user to a group by email', async () => {
|
||||
@@ -258,11 +258,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
describe('user and email invites', () => {
|
||||
it('returns an error when emails and uuids are not provided', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteEmailUuid'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteEmailUuid'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT uuids and emails', async () => {
|
||||
@@ -281,11 +281,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
emails,
|
||||
uuids,
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
});
|
||||
});
|
||||
|
||||
it('invites users to a group by uuid and email', async () => {
|
||||
@@ -330,11 +330,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInivite._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInvitedToGroup'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInvitedToGroup'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when invited user is already in the group', async () => {
|
||||
@@ -347,11 +347,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInGroup'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInGroup'),
|
||||
});
|
||||
});
|
||||
|
||||
it('allows 30+ members in a guild', async () => {
|
||||
@@ -380,11 +380,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(nonGroupLeader.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('onlyGroupLeaderCanInviteToGroupPlan'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('onlyGroupLeaderCanInviteToGroupPlan'),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -407,11 +407,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyPendingInvitation'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyPendingInvitation'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when invited user is already in a party of more than 1 member', async () => {
|
||||
@@ -426,11 +426,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInAParty'),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInAParty'),
|
||||
});
|
||||
});
|
||||
|
||||
it('allow inviting a user to a party if they are partying solo', async () => {
|
||||
@@ -512,11 +512,11 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
await expect(inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: generatedInvites.map(invite => invite._id),
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('partyExceedsMembersLimit', {maxMembersParty: PARTY_LIMIT_MEMBERS}),
|
||||
});
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('partyExceedsMembersLimit', {maxMembersParty: PARTY_LIMIT_MEMBERS}),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user