File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,18 @@ describe('getPath()', () => {
76
76
} ) ;
77
77
} ) ;
78
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
+
79
91
test ( 'path breaks' , ( ) => {
80
92
expect ( getPath ( { a : { } } , 'a.b.c' ) ) . toEqual ( {
81
93
hasEndProp : false ,
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export const getPath = (
81
81
result . traversedPath . unshift ( prop ) ;
82
82
83
83
if ( lastProp ) {
84
- result . hasEndProp = hasOwnProperty ( object , prop ) ;
84
+ result . hasEndProp = prop in object ;
85
85
if ( ! result . hasEndProp ) {
86
86
result . traversedPath . shift ( ) ;
87
87
}
You can’t perform that action at this time.
0 commit comments