File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,15 @@ export default function createFieldsTest(
34
34
const fieldByProperty = ( ipos_for_probing . myField as any ) . __original ?? ipos_for_probing . myField
35
35
const fieldByFunction = ( ipos_for_probing . get ( 'myField' ) as any ) . __original ?? ipos_for_probing . get ( 'myField' )
36
36
37
- // lodash equal to compare maps and sets
38
- expect ( _ . isEqualWith ( fieldByProperty , value , customizer ) ) . toEqual ( true )
39
- expect ( _ . isEqualWith ( fieldByFunction , value , customizer ) ) . toEqual ( true )
37
+ // some objects cannot be "the same" (e.g. instances not holding data)
38
+ if ( [ EventTarget ] . some ( type => value instanceof type ) ) {
39
+ expect ( fieldByProperty . constructor === value . constructor ) . toBe ( true )
40
+ expect ( fieldByFunction . constructor === value . constructor ) . toBe ( true )
41
+ } else {
42
+ // lodash equal to compare maps and sets
43
+ expect ( _ . isEqualWith ( fieldByProperty , value , customizer ) ) . toEqual ( true )
44
+ expect ( _ . isEqualWith ( fieldByFunction , value , customizer ) ) . toEqual ( true )
45
+ }
40
46
}
41
47
)
42
48
} )
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ export const examples = {
32
32
} ) ) ,
33
33
'set' : new Set ( [ 'myItem' , 42 ] ) ,
34
34
'function' : ( a : number , b : number ) => a + b ,
35
- 'class' : new TestClass ( 'myClass' )
35
+ 'class' : new TestClass ( 'myClass' ) ,
36
+ 'eventTarget' : new EventTarget ( ) ,
36
37
}
37
38
38
39
// exemplary; don't iterate every possible method, just do one direct value assignment and one method
You can’t perform that action at this time.
0 commit comments