mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
3d989eba23
refs https://github.com/TryGhost/Toolbox/issues/354 - this commit turns the Ghost repo into a monorepo so we can bring our internal packages back in, which makes life easier when working on Ghost
20 lines
626 B
JavaScript
20 lines
626 B
JavaScript
const should = require('should');
|
|
const 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();
|
|
});
|
|
});
|