20 lines
468 B
JavaScript
20 lines
468 B
JavaScript
|
'use strict';
|
||
|
|
||
|
module.exports = function(chai, utils) {
|
||
|
|
||
|
utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) {
|
||
|
|
||
|
var actual = JSON.stringify(this._obj);
|
||
|
var expected = JSON.stringify(comparison);
|
||
|
|
||
|
this.assert(
|
||
|
actual == expected,
|
||
|
'expected #{this} to deep equal #{act}',
|
||
|
'expected #{this} not to deep equal #{act}',
|
||
|
comparison, // expected
|
||
|
this._obj, // actual
|
||
|
true // show diff
|
||
|
);
|
||
|
});
|
||
|
};
|