chore(test/matchers): improve jsonEquals matcher
This commit is contained in:
parent
087c9575b5
commit
628e2d1019
|
@ -1,16 +1,16 @@
|
|||
export default function(chai, utils) {
|
||||
|
||||
utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) {
|
||||
utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison, filter) {
|
||||
|
||||
var actual = JSON.stringify(this._obj);
|
||||
var expected = JSON.stringify(comparison);
|
||||
var actual = JSON.stringify(this._obj, filter, ' ');
|
||||
var expected = JSON.stringify(comparison, filter, ' ');
|
||||
|
||||
this.assert(
|
||||
actual == expected,
|
||||
'expected #{this} to deep equal #{act}',
|
||||
'expected #{this} not to deep equal #{act}',
|
||||
comparison, // expected
|
||||
this._obj, // actual
|
||||
'expected #{this} to json equal #{exp} but got #{act}',
|
||||
'expected #{this} not to json equal #{exp}',
|
||||
expected, // expected
|
||||
actual, // actual
|
||||
true // show diff
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue