mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
db1d2f62dd
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
29 lines
937 B
JavaScript
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');
|
|
});
|
|
});
|
|
});
|