Fixed webhook model unit test

This commit is contained in:
Naz 2021-03-04 14:13:45 +13:00 committed by Thibaut Patel
parent 38fbfe0bde
commit 4ac5feaa0a

View File

@ -102,7 +102,10 @@ describe('Validation', function () {
describe('webhooks.add', function () {
it('event name is not lowercase', function () {
const webhook = models.Webhook.forge(testUtils.DataGenerator.forKnex.createWebhook({event: 'Test'}));
const webhook = models.Webhook.forge(testUtils.DataGenerator.forKnex.createWebhook({
event: 'Test',
integration_id: testUtils.DataGenerator.Content.integrations[0].id
}));
// NOTE: Fields with `defaultTo` are getting ignored. This is handled on the DB level.
return validation.validateSchema('webhooks', webhook, {method: 'insert'})
@ -114,9 +117,9 @@ describe('Validation', function () {
throw err;
}
err.length.should.eql(2);
err.length.should.eql(1);
err[0].errorType.should.eql('ValidationError');
err[1].errorType.should.eql('ValidationError');
err[0].message.should.match(/isLowercase/);
});
});
});