mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-02 07:43:11 +03:00
fb044e6d88
refs #9389 - https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md Breaking changes for Ghost: - no need to create a sandbox anymore, each file get's it's own sandbox - just require sinon and use this sandbox - you can still create separate sandboxes with .createSandbox - reset single stubs: use .resetHistory instead of .reset This is a global replace for any sandbox creation. --- From https://sinonjs.org/releases/v7.2.3/sandbox/ > Default sandbox > Since sinon@5.0.0, the sinon object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one.
27 lines
894 B
JavaScript
27 lines
894 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');
|
|
|
|
describe('Unit: models/webhooks', function () {
|
|
before(function () {
|
|
models.init();
|
|
});
|
|
after(function () {
|
|
sinon.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');
|
|
});
|
|
});
|
|
});
|