0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

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 () { describe('webhooks.add', function () {
it('event name is not lowercase', 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. // NOTE: Fields with `defaultTo` are getting ignored. This is handled on the DB level.
return validation.validateSchema('webhooks', webhook, {method: 'insert'}) return validation.validateSchema('webhooks', webhook, {method: 'insert'})
@ -114,9 +117,9 @@ describe('Validation', function () {
throw err; throw err;
} }
err.length.should.eql(2); err.length.should.eql(1);
err[0].errorType.should.eql('ValidationError'); err[0].errorType.should.eql('ValidationError');
err[1].errorType.should.eql('ValidationError'); err[0].message.should.match(/isLowercase/);
}); });
}); });
}); });