Ghost/core/test/unit/models/webhook_spec.js
Katharina Irrgang db1d2f62dd
Removed api integration tests (#9940)
refs #9866 

- moved the tests either to unit tests or routing tests
- or removed test case (a lot)
- this commit is very big 🤪, it was not rly possible to create clean commits for this
- it only changes the test env, no real code is touched

Next steps:
- optimise folder structure + make v2 testing possible
- reduce some more tests from routing and model integeration tests
2018-10-06 22:13:52 +02:00

29 lines
937 B
JavaScript

const should = require('should');
const url = require('url');
const sinon = require('sinon');
const models = require('../../../server/models');
const testUtils = require('../../utils');
const {knex} = require('../../../server/data/db');
const sandbox = sinon.sandbox.create();
describe('Unit: models/webhooks', function () {
before(function () {
models.init();
});
after(function () {
sandbox.restore();
});
before(testUtils.teardown);
before(testUtils.setup('webhooks'));
it('can correctly use getByEventAndTarget', function () {
return models.Webhook.getByEventAndTarget('subscriber.added', 'https://example.com/webhooks/subscriber-added')
.then(function (webhook) {
webhook.get('event').should.eql('subscriber.added');
webhook.get('target_url').should.eql('https://example.com/webhooks/subscriber-added');
});
});
});