Merge branch 'develop' into fix-antidotes-from-revert

This commit is contained in:
Xaz16
2019-11-17 23:54:09 +03:00
411 changed files with 29206 additions and 29664 deletions
@@ -206,16 +206,16 @@ describe('GET /challenges/:challengeId/members', () => {
for (let i = 0; i < 3; i += 1) {
usersToGenerate.push(generateUser({
challenges: [challenge._id],
'profile.name': `${i}profilename`,
'auth.local.username': `${i}username`,
}));
}
const generatedUsers = await Promise.all(usersToGenerate);
const profileNames = generatedUsers.map(generatedUser => generatedUser.profile.name);
const usernames = generatedUsers.map(generatedUser => generatedUser.auth.local.username);
const firstProfileName = profileNames[0];
const nameToSearch = firstProfileName.substring(0, 4);
const firstUsername = usernames[0];
const nameToSearch = firstUsername.substring(0, 4);
const response = await user.get(`/challenges/${challenge._id}/members?search=${nameToSearch}`);
expect(response[0].profile.name).to.eql(firstProfileName);
expect(response[0].auth.local.username).to.eql(firstUsername);
});
});
@@ -63,6 +63,26 @@ describe('PUT /user/webhook/:id', () => {
expect(webhook.options).to.eql(options);
});
it('updates a webhook with empty label', async () => {
const url = 'http://a-new-url.com';
const type = 'groupChatReceived';
const label = '';
const options = { groupId: generateUUID() };
await user.put(`/user/webhook/${webhookToUpdate.id}`, {
url, type, options, label,
});
await user.sync();
const webhook = user.webhooks.find(hook => webhookToUpdate.id === hook.id);
expect(webhook.url).to.equal(url);
expect(webhook.label).to.equal(label);
expect(webhook.type).to.equal(type);
expect(webhook.options).to.eql(options);
});
it('returns the updated webhook', async () => {
const url = 'http://a-new-url.com';
const type = 'groupChatReceived';