fix(api): Prevent webhooks from having duplicate ids

This commit is contained in:
Blade Barringer
2016-10-03 08:13:33 -05:00
parent 04fd907a45
commit 8b6052a3ca
3 changed files with 21 additions and 1 deletions

View File

@@ -100,6 +100,16 @@ describe('POST /user/webhook', () => {
expect(webhook.url).to.eql(body.url);
});
it('cannot use an id of a webhook that already exists', async () => {
await user.post('/user/webhook', body);
await expect(user.post('/user/webhook', body)).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('webhookIdAlreadyTaken', { id: body.id }),
});
});
it('defaults taskActivity options', async () => {
body.type = 'taskActivity';