mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
Refactored trigger test to us assert instead of should
refs https://github.com/TryGhost/Toolbox/issues/283 - Should assertion library is outdated and it's preferred to use native assert to make assertions
This commit is contained in:
parent
21c2c5579b
commit
2a3be178ab
@ -1,4 +1,4 @@
|
||||
const should = require('should');
|
||||
const assert = require('assert');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const WebhookTrigger = require('../../../../../core/server/services/webhooks/trigger');
|
||||
@ -33,8 +33,8 @@ describe('Webhook Service', function () {
|
||||
|
||||
await webhookTrigger.trigger('post.added');
|
||||
|
||||
should.equal(models.Webhook.findAllByEvent.called, true);
|
||||
should.equal(payload.called, false);
|
||||
assert.equal(models.Webhook.findAllByEvent.called, true);
|
||||
assert.equal(payload.called, false);
|
||||
});
|
||||
|
||||
it('Does triggers payload handler and request when event when model has a registered hook', async function () {
|
||||
@ -68,14 +68,14 @@ describe('Webhook Service', function () {
|
||||
});
|
||||
await webhookTrigger.trigger('post.added', postModelStub);
|
||||
|
||||
should.equal(models.Webhook.findAllByEvent.called, true);
|
||||
should.equal(payload.called, true);
|
||||
assert.equal(models.Webhook.findAllByEvent.called, true);
|
||||
assert.equal(payload.called, true);
|
||||
|
||||
should.equal(requestStub.called, true);
|
||||
should.equal(requestStub.args[0][0], 'http://example.com');
|
||||
should.deepEqual(requestStub.args[0][1].body, '{"data":[1]}');
|
||||
should.equal(requestStub.args[0][1].headers['Content-Length'], 12);
|
||||
should.equal(requestStub.args[0][1].headers['Content-Length'], 'application/json');
|
||||
assert.equal(requestStub.called, true);
|
||||
assert.equal(requestStub.args[0][0], 'http://example.com');
|
||||
assert.deepEqual(requestStub.args[0][1].body, '{"data":[1]}');
|
||||
assert.equal(requestStub.args[0][1].headers['Content-Length'], 12);
|
||||
assert.equal(requestStub.args[0][1].headers['Content-Type'], 'application/json');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user