mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
fix test lint
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import nconf from 'nconf';
|
||||
|
||||
const INVITES_LIMIT = 100;
|
||||
const PARTY_LIMIT_MEMBERS = 30;
|
||||
@@ -13,10 +13,10 @@ const MAX_EMAIL_INVITES_BY_USER = 200;
|
||||
describe('Post /groups/:groupId/invite', () => {
|
||||
let inviter;
|
||||
let group;
|
||||
let groupName = 'Test Public Guild';
|
||||
const groupName = 'Test Public Guild';
|
||||
|
||||
beforeEach(async () => {
|
||||
inviter = await generateUser({balance: 4});
|
||||
inviter = await generateUser({ balance: 4 });
|
||||
group = await inviter.post('/groups', {
|
||||
name: groupName,
|
||||
type: 'guild',
|
||||
@@ -33,7 +33,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithUsernameNotFound', {username: fakeID}),
|
||||
message: t('userWithUsernameNotFound', { username: fakeID }),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,7 +69,10 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
const userToInvite2 = await generateUser();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
usernames: [userToInvite.auth.local.lowerCaseUsername, userToInvite2.auth.local.lowerCaseUsername],
|
||||
usernames: [
|
||||
userToInvite.auth.local.lowerCaseUsername,
|
||||
userToInvite2.auth.local.lowerCaseUsername,
|
||||
],
|
||||
})).to.eventually.deep.equal([
|
||||
{
|
||||
id: group._id,
|
||||
@@ -92,8 +95,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
describe('user id invites', () => {
|
||||
it('returns an error when inviter has no chat privileges', async () => {
|
||||
let inviterMuted = await inviter.update({'flags.chatRevoked': true});
|
||||
let userToInvite = await generateUser();
|
||||
const inviterMuted = await inviter.update({ 'flags.chatRevoked': true });
|
||||
const userToInvite = await generateUser();
|
||||
await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
@@ -105,7 +108,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when invited user is not found', async () => {
|
||||
let fakeID = generateUUID();
|
||||
const fakeID = generateUUID();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [fakeID],
|
||||
@@ -113,7 +116,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
message: t('userWithIDNotFound', { userId: fakeID }),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -129,10 +132,10 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when uuids is not an array', async () => {
|
||||
let fakeID = generateUUID();
|
||||
const fakeID = generateUUID();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: {fakeID},
|
||||
uuids: { fakeID },
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -165,7 +168,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT uuids', async () => {
|
||||
let uuids = [];
|
||||
const uuids = [];
|
||||
|
||||
for (let i = 0; i < 101; i += 1) {
|
||||
uuids.push(generateUUID());
|
||||
@@ -177,13 +180,13 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
message: t('canOnlyInviteMaxInvites', { maxInvites: INVITES_LIMIT }),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns error when recipient has blocked the senders', async () => {
|
||||
const inviterNoBlocks = await inviter.update({'inbox.blocks': []});
|
||||
let userWithBlockedInviter = await generateUser({'inbox.blocks': [inviter._id]});
|
||||
const inviterNoBlocks = await inviter.update({ 'inbox.blocks': [] });
|
||||
const userWithBlockedInviter = await generateUser({ 'inbox.blocks': [inviter._id] });
|
||||
await expect(inviterNoBlocks.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userWithBlockedInviter._id],
|
||||
}))
|
||||
@@ -195,7 +198,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('invites a user to a group by uuid', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
@@ -211,8 +214,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('invites multiple users to a group by uuid', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
let userToInvite2 = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
const userToInvite2 = await generateUser();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id, userToInvite2._id],
|
||||
@@ -236,8 +239,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when inviting multiple users and a user is not found', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
let fakeID = generateUUID();
|
||||
const userToInvite = await generateUser();
|
||||
const fakeID = generateUUID();
|
||||
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id, fakeID],
|
||||
@@ -245,16 +248,16 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
error: 'NotFound',
|
||||
message: t('userWithIDNotFound', {userId: fakeID}),
|
||||
message: t('userWithIDNotFound', { userId: fakeID }),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('email invites', () => {
|
||||
let testInvite = {name: 'test', email: 'test@habitica.com'};
|
||||
const testInvite = { name: 'test', email: 'test@habitica.com' };
|
||||
|
||||
it('returns an error when inviter has no chat privileges', async () => {
|
||||
let inviterMuted = await inviter.update({'flags.chatRevoked': true});
|
||||
const inviterMuted = await inviter.update({ 'flags.chatRevoked': true });
|
||||
await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
|
||||
emails: [testInvite],
|
||||
inviter: 'inviter name',
|
||||
@@ -268,7 +271,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
it('returns an error when invite is missing an email', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [{name: 'test'}],
|
||||
emails: [{ name: 'test' }],
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -279,7 +282,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
it('returns an error when emails is not an array', async () => {
|
||||
await expect(inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: {testInvite},
|
||||
emails: { testInvite },
|
||||
}))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
@@ -300,7 +303,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT emails', async () => {
|
||||
let emails = [];
|
||||
const emails = [];
|
||||
|
||||
for (let i = 0; i < 101; i += 1) {
|
||||
emails.push(`${generateUUID()}@habitica.com`);
|
||||
@@ -312,16 +315,16 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
message: t('canOnlyInviteMaxInvites', { maxInvites: INVITES_LIMIT }),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when a user has sent the max number of email invites', async () => {
|
||||
let inviterWithMax = await generateUser({
|
||||
const inviterWithMax = await generateUser({
|
||||
invitesSent: MAX_EMAIL_INVITES_BY_USER,
|
||||
balance: 4,
|
||||
});
|
||||
let tmpGroup = await inviterWithMax.post('/groups', {
|
||||
const tmpGroup = await inviterWithMax.post('/groups', {
|
||||
name: groupName,
|
||||
type: 'guild',
|
||||
});
|
||||
@@ -333,28 +336,28 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('inviteLimitReached', {techAssistanceEmail: nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL')}),
|
||||
message: t('inviteLimitReached', { techAssistanceEmail: nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL') }),
|
||||
});
|
||||
});
|
||||
|
||||
it('invites a user to a group by email', async () => {
|
||||
let res = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
const res = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [testInvite],
|
||||
inviter: 'inviter name',
|
||||
});
|
||||
|
||||
let updatedUser = await inviter.sync();
|
||||
const updatedUser = await inviter.sync();
|
||||
|
||||
expect(res).to.exist;
|
||||
expect(updatedUser.invitesSent).to.eql(1);
|
||||
});
|
||||
|
||||
it('invites multiple users to a group by email', async () => {
|
||||
let res = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [testInvite, {name: 'test2', email: 'test2@habitica.com'}],
|
||||
const res = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
emails: [testInvite, { name: 'test2', email: 'test2@habitica.com' }],
|
||||
});
|
||||
|
||||
let updatedUser = await inviter.sync();
|
||||
const updatedUser = await inviter.sync();
|
||||
|
||||
expect(res).to.exist;
|
||||
expect(updatedUser.invitesSent).to.eql(2);
|
||||
@@ -372,8 +375,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when there are more than INVITES_LIMIT uuids and emails', async () => {
|
||||
let emails = [];
|
||||
let uuids = [];
|
||||
const emails = [];
|
||||
const uuids = [];
|
||||
|
||||
for (let i = 0; i < 50; i += 1) {
|
||||
emails.push(`${generateUUID()}@habitica.com`);
|
||||
@@ -390,35 +393,35 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('canOnlyInviteMaxInvites', {maxInvites: INVITES_LIMIT}),
|
||||
message: t('canOnlyInviteMaxInvites', { maxInvites: INVITES_LIMIT }),
|
||||
});
|
||||
});
|
||||
|
||||
it('invites users to a group by uuid and email', async () => {
|
||||
let newUser = await generateUser();
|
||||
let invite = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
const newUser = await generateUser();
|
||||
const invite = await inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [newUser._id],
|
||||
emails: [{name: 'test', email: 'test@habitica.com'}],
|
||||
emails: [{ name: 'test', email: 'test@habitica.com' }],
|
||||
});
|
||||
let invitedUser = await newUser.get('/user');
|
||||
const invitedUser = await newUser.get('/user');
|
||||
|
||||
expect(invitedUser.invitations.guilds[0].id).to.equal(group._id);
|
||||
expect(invite).to.exist;
|
||||
});
|
||||
|
||||
it('invites marks invite with cancelled plan', async () => {
|
||||
let cancelledPlanGroup = await generateGroup(inviter, {
|
||||
const cancelledPlanGroup = await generateGroup(inviter, {
|
||||
type: 'guild',
|
||||
name: generateUUID(),
|
||||
});
|
||||
await cancelledPlanGroup.createCancelledSubscription();
|
||||
|
||||
let newUser = await generateUser();
|
||||
let invite = await inviter.post(`/groups/${cancelledPlanGroup._id}/invite`, {
|
||||
const newUser = await generateUser();
|
||||
const invite = await inviter.post(`/groups/${cancelledPlanGroup._id}/invite`, {
|
||||
uuids: [newUser._id],
|
||||
emails: [{name: 'test', email: 'test@habitica.com'}],
|
||||
emails: [{ name: 'test', email: 'test@habitica.com' }],
|
||||
});
|
||||
let invitedUser = await newUser.get('/user');
|
||||
const invitedUser = await newUser.get('/user');
|
||||
|
||||
expect(invitedUser.invitations.guilds[0].id).to.equal(cancelledPlanGroup._id);
|
||||
expect(invitedUser.invitations.guilds[0].cancelledPlan).to.be.true;
|
||||
@@ -428,8 +431,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
describe('guild invites', () => {
|
||||
it('returns an error when inviter has no chat privileges', async () => {
|
||||
let inviterMuted = await inviter.update({'flags.chatRevoked': true});
|
||||
let userToInvite = await generateUser();
|
||||
const inviterMuted = await inviter.update({ 'flags.chatRevoked': true });
|
||||
const userToInvite = await generateUser();
|
||||
await expect(inviterMuted.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
@@ -441,7 +444,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when invited user is already invited to the group', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
await inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
});
|
||||
@@ -452,12 +455,12 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInvitedToGroup', { userId: userToInvite._id, username: userToInvite.profile.name}),
|
||||
message: t('userAlreadyInvitedToGroup', { userId: userToInvite._id, username: userToInvite.profile.name }),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when invited user is already in the group', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
await inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
});
|
||||
@@ -469,17 +472,17 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInGroup', { userId: userToInvite._id, username: userToInvite.profile.name}),
|
||||
message: t('userAlreadyInGroup', { userId: userToInvite._id, username: userToInvite.profile.name }),
|
||||
});
|
||||
});
|
||||
|
||||
it('allows 30+ members in a guild', async () => {
|
||||
let invitesToGenerate = [];
|
||||
const invitesToGenerate = [];
|
||||
// Generate 30 users to invite (30 + leader = 31 members)
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i++) {
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i += 1) {
|
||||
invitesToGenerate.push(generateUser());
|
||||
}
|
||||
let generatedInvites = await Promise.all(invitesToGenerate);
|
||||
const generatedInvites = await Promise.all(invitesToGenerate);
|
||||
// Invite users
|
||||
expect(await inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: generatedInvites.map(invite => invite._id),
|
||||
@@ -488,9 +491,9 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
// @TODO: Add this after we are able to mock the group plan route
|
||||
xit('returns an error when a non-leader invites to a group plan', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
|
||||
let nonGroupLeader = await generateUser();
|
||||
const nonGroupLeader = await generateUser();
|
||||
await inviter.post(`/groups/${group._id}/invite`, {
|
||||
uuids: [nonGroupLeader._id],
|
||||
});
|
||||
@@ -518,8 +521,8 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when inviter has no chat privileges', async () => {
|
||||
let inviterMuted = await inviter.update({'flags.chatRevoked': true});
|
||||
let userToInvite = await generateUser();
|
||||
const inviterMuted = await inviter.update({ 'flags.chatRevoked': true });
|
||||
const userToInvite = await generateUser();
|
||||
await expect(inviterMuted.post(`/groups/${party._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
}))
|
||||
@@ -531,7 +534,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('returns an error when invited user has a pending invitation to the party', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
await inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: [userToInvite._id],
|
||||
});
|
||||
@@ -542,13 +545,13 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyPendingInvitation', { userId: userToInvite._id, username: userToInvite.profile.name}),
|
||||
message: t('userAlreadyPendingInvitation', { userId: userToInvite._id, username: userToInvite.profile.name }),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error when invited user is already in a party of more than 1 member', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
let userToInvite2 = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
const userToInvite2 = await generateUser();
|
||||
await inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: [userToInvite._id, userToInvite2._id],
|
||||
});
|
||||
@@ -561,12 +564,12 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
message: t('userAlreadyInAParty', { userId: userToInvite._id, username: userToInvite.profile.name}),
|
||||
message: t('userAlreadyInAParty', { userId: userToInvite._id, username: userToInvite.profile.name }),
|
||||
});
|
||||
});
|
||||
|
||||
it('allow inviting a user to a party if they are partying solo', async () => {
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
await userToInvite.post('/groups', { // add user to a party
|
||||
name: 'Another Test Party',
|
||||
type: 'party',
|
||||
@@ -580,13 +583,13 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
|
||||
it('allow inviting a user to 2 different parties', async () => {
|
||||
// Create another inviter
|
||||
let inviter2 = await generateUser();
|
||||
const inviter2 = await generateUser();
|
||||
|
||||
// Create user to invite
|
||||
let userToInvite = await generateUser();
|
||||
const userToInvite = await generateUser();
|
||||
|
||||
// Create second group
|
||||
let party2 = await inviter2.post('/groups', {
|
||||
const party2 = await inviter2.post('/groups', {
|
||||
name: 'Test Party 2',
|
||||
type: 'party',
|
||||
});
|
||||
@@ -602,7 +605,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
// Get updated user
|
||||
let invitedUser = await userToInvite.get('/user');
|
||||
const invitedUser = await userToInvite.get('/user');
|
||||
|
||||
expect(invitedUser.invitations.parties.length).to.equal(2);
|
||||
expect(invitedUser.invitations.parties[0].id).to.equal(party._id);
|
||||
@@ -610,7 +613,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('allow inviting a user if party id is not associated with a real party', async () => {
|
||||
let userToInvite = await generateUser({
|
||||
const userToInvite = await generateUser({
|
||||
party: { _id: generateUUID() },
|
||||
});
|
||||
|
||||
@@ -621,12 +624,12 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
});
|
||||
|
||||
it('allows 30 members in a party', async () => {
|
||||
let invitesToGenerate = [];
|
||||
const invitesToGenerate = [];
|
||||
// Generate 29 users to invite (29 + leader = 30 members)
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS - 1; i++) {
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS - 1; i += 1) {
|
||||
invitesToGenerate.push(generateUser());
|
||||
}
|
||||
let generatedInvites = await Promise.all(invitesToGenerate);
|
||||
const generatedInvites = await Promise.all(invitesToGenerate);
|
||||
// Invite users
|
||||
expect(await inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: generatedInvites.map(invite => invite._id),
|
||||
@@ -634,12 +637,12 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
}).timeout(10000);
|
||||
|
||||
it('does not allow 30+ members in a party', async () => {
|
||||
let invitesToGenerate = [];
|
||||
const invitesToGenerate = [];
|
||||
// Generate 30 users to invite (30 + leader = 31 members)
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i++) {
|
||||
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i += 1) {
|
||||
invitesToGenerate.push(generateUser());
|
||||
}
|
||||
let generatedInvites = await Promise.all(invitesToGenerate);
|
||||
const generatedInvites = await Promise.all(invitesToGenerate);
|
||||
// Invite users
|
||||
await expect(inviter.post(`/groups/${party._id}/invite`, {
|
||||
uuids: generatedInvites.map(invite => invite._id),
|
||||
@@ -647,7 +650,7 @@ describe('Post /groups/:groupId/invite', () => {
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('partyExceedsMembersLimit', {maxMembersParty: PARTY_LIMIT_MEMBERS}),
|
||||
message: t('partyExceedsMembersLimit', { maxMembersParty: PARTY_LIMIT_MEMBERS }),
|
||||
});
|
||||
}).timeout(10000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user