Ghost/test/utils/assertions.js
Hannah Wolfe 7f1d3ebc07
Move tests from core to root (#11700)
- move all test files from core/test to test/
- updated all imports and other references
- all code inside of core/ is then application code
- tests are correctly at the root level
- consistent with other repos/projects

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-03-30 16:26:47 +01:00

20 lines
622 B
JavaScript

var should = require('should'),
errorProps = ['message', 'errorType'];
should.Assertion.add('JSONErrorObject', function () {
this.params = {operator: 'to be a valid JSON Error Object'};
this.obj.should.be.an.Object();
this.obj.should.have.properties(errorProps);
});
should.Assertion.add('JSONErrorResponse', function () {
this.params = {operator: 'to be a valid JSON Error Response'};
this.obj.should.have.property('errors').which.is.an.Array();
this.obj.errors.length.should.be.above(0);
this.obj.errors.forEach(function (err) {
err.should.be.a.JSONErrorObject();
});
});