mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
6bffa893b1
refs https://github.com/TryGhost/Team/issues/1795 - Snapshots help us detect unexpected changes in the `<head>` of all sites (e.g., newly introduced script tags) - Added ghost_head tests for comment count helper
23 lines
759 B
JavaScript
23 lines
759 B
JavaScript
const should = require('should');
|
|
const errorProps = ['message', 'errorType'];
|
|
const {matchSnapshotAssertion} = require('@tryghost/jest-snapshot');
|
|
|
|
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();
|
|
});
|
|
});
|
|
|
|
should.Assertion.add('matchSnapshot', matchSnapshotAssertion);
|