@@ -33,6 +33,13 @@ test('includeKeys: non-enumerable properties are omitted', t => {
33
33
t . is ( includeKeys ( input , ( ) => true ) . test , undefined ) ;
34
34
} ) ;
35
35
36
+ test ( 'includeKeys: descriptors are kept as is' , t => {
37
+ const descriptor = { get ( ) { } , set ( ) { } , enumerable : true , configurable : false } ;
38
+ const input = Object . defineProperty ( { } , 'test' , descriptor ) ;
39
+ t . deepEqual ( Object . getOwnPropertyDescriptor ( includeKeys ( input , ( ) => true ) , 'test' ) , descriptor ) ;
40
+ t . deepEqual ( Object . getOwnPropertyDescriptor ( includeKeys ( input , [ 'test' ] ) , 'test' ) , descriptor ) ;
41
+ } ) ;
42
+
36
43
test ( 'includeKeys: inherited properties are omitted' , t => {
37
44
const Parent = class {
38
45
test ( ) { }
@@ -79,6 +86,13 @@ test('excludeKeys: non-enumerable properties are omitted', t => {
79
86
t . is ( excludeKeys ( input , ( ) => false ) . test , undefined ) ;
80
87
} ) ;
81
88
89
+ test ( 'excludeKeys: descriptors are kept as is' , t => {
90
+ const descriptor = { get ( ) { } , set ( ) { } , enumerable : true , configurable : false } ;
91
+ const input = Object . defineProperty ( { } , 'test' , descriptor ) ;
92
+ t . deepEqual ( Object . getOwnPropertyDescriptor ( excludeKeys ( input , ( ) => false ) , 'test' ) , descriptor ) ;
93
+ t . deepEqual ( Object . getOwnPropertyDescriptor ( excludeKeys ( input , [ ] ) , 'test' ) , descriptor ) ;
94
+ } ) ;
95
+
82
96
test ( 'excludeKeys: inherited properties are omitted' , t => {
83
97
const Parent = class {
84
98
test ( ) { }
0 commit comments