Improved assertions

refs https://github.com/TryGhost/Toolbox/issues/283
This commit is contained in:
Naz 2022-05-12 11:47:33 +08:00 committed by naz
parent a1e1feb125
commit 7252f03824

View File

@ -73,7 +73,8 @@ describe('Webhook Service', function () {
assert.equal(requestStub.called, true); assert.equal(requestStub.called, true);
assert.equal(requestStub.args[0][0], 'http://example.com'); assert.equal(requestStub.args[0][0], 'http://example.com');
assert.deepEqual(requestStub.args[0][1].body, '{"data":[1]}'); assert.equal(requestStub.args[0][1].body, '{"data":[1]}');
assert.deepEqual(Object.keys(requestStub.args[0][1].headers), ['Content-Length', 'Content-Type', 'Content-Version']);
assert.equal(requestStub.args[0][1].headers['Content-Length'], 12); assert.equal(requestStub.args[0][1].headers['Content-Length'], 12);
assert.equal(requestStub.args[0][1].headers['Content-Type'], 'application/json'); assert.equal(requestStub.args[0][1].headers['Content-Type'], 'application/json');
assert.match(requestStub.args[0][1].headers['Content-Version'], /v\d+\.\d+/); assert.match(requestStub.args[0][1].headers['Content-Version'], /v\d+\.\d+/);