Include property value mismatches in diffs even when there are missing or extra properties
This commit is contained in:
@@ -5253,7 +5253,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|||||||
diffBuilder.recordMismatch(
|
diffBuilder.recordMismatch(
|
||||||
objectKeysAreDifferentFormatter.bind(null, this.pp)
|
objectKeysAreDifferentFormatter.bind(null, this.pp)
|
||||||
);
|
);
|
||||||
return false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of aKeys) {
|
for (const key of aKeys) {
|
||||||
|
|||||||
@@ -96,6 +96,16 @@ describe('toEqual', function() {
|
|||||||
expect(compareEquals(actual, expected).message).toEqual(message);
|
expect(compareEquals(actual, expected).message).toEqual(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('reports mismatches as well as missing or extra properties', function() {
|
||||||
|
const actual = { x: { z: 2 } },
|
||||||
|
expected = { x: { y: 1, z: 3 } },
|
||||||
|
message = 'Expected $.x to have properties\n' +
|
||||||
|
' y: 1\n' +
|
||||||
|
'Expected $.x.z = 2 to equal 3.';
|
||||||
|
|
||||||
|
expect(compareEquals(actual, expected).message).toEqual(message);
|
||||||
|
});
|
||||||
|
|
||||||
it('reports missing symbol properties', function() {
|
it('reports missing symbol properties', function() {
|
||||||
const actual = { x: {} },
|
const actual = { x: {} },
|
||||||
expected = { x: { [Symbol('y')]: 1 } },
|
expected = { x: { [Symbol('y')]: 1 } },
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|||||||
diffBuilder.recordMismatch(
|
diffBuilder.recordMismatch(
|
||||||
objectKeysAreDifferentFormatter.bind(null, this.pp)
|
objectKeysAreDifferentFormatter.bind(null, this.pp)
|
||||||
);
|
);
|
||||||
return false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of aKeys) {
|
for (const key of aKeys) {
|
||||||
|
|||||||
Reference in New Issue
Block a user