We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 967b335 commit a80b810Copy full SHA for a80b810
packages/expect/src/__tests__/utils.test.js
@@ -76,6 +76,18 @@ describe('getPath()', () => {
76
});
77
78
79
+ test('property is inherited', () => {
80
+ class A {}
81
+ A.prototype.a = 'a';
82
+
83
+ expect(getPath(new A(), 'a')).toEqual({
84
+ hasEndProp: true,
85
+ lastTraversedObject: new A(),
86
+ traversedPath: ['a'],
87
+ value: 'a',
88
+ });
89
90
91
test('path breaks', () => {
92
expect(getPath({a: {}}, 'a.b.c')).toEqual({
93
hasEndProp: false,
packages/expect/src/utils.js
@@ -81,7 +81,7 @@ export const getPath = (
result.traversedPath.unshift(prop);
if (lastProp) {
- result.hasEndProp = hasOwnProperty(object, prop);
+ result.hasEndProp = prop in object;
if (!result.hasEndProp) {
result.traversedPath.shift();
}
0 commit comments