File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,35 @@ describe('test/lib/core/utils.test.js', () => {
125
125
assert ( obj . undefined$ === undefined ) ;
126
126
assert ( obj . boolean$ === '<Boolean>' ) ;
127
127
assert ( obj . symbol$ === '<Symbol>' ) ;
128
+ assert ( obj . regexp$ === '<RegExp>' ) ;
129
+ } ) ;
130
+
131
+ it ( 'should convert a plain recursive object' , ( ) => {
132
+ const obj = {
133
+ plainObj : 'Plain' ,
134
+ Id : 1 ,
135
+ recurisiveObj : {
136
+ value1 : 'string' ,
137
+ value2 : 1 ,
138
+ ignoreValue : / ^ [ a - z ] / ,
139
+ } ,
140
+ } ;
141
+ utils . convertObject ( obj , [ 'ignoreValue' ] ) ;
142
+ assert ( obj . recurisiveObj . value1 === 'string' ) ;
143
+ assert ( obj . recurisiveObj . value2 === 1 ) ;
144
+ assert ( obj . recurisiveObj . ignoreValue === '<RegExp>' ) ;
145
+ assert ( obj . plainObj === 'Plain' ) ;
146
+ assert ( obj . Id === 1 ) ;
147
+ } ) ;
148
+
149
+ it ( 'should convert an anonymous class' , ( ) => {
150
+ const obj = {
151
+ anonymousClassWithPropName : class { } ,
152
+ '' : class { } ,
153
+ } ;
154
+ utils . convertObject ( obj ) ;
155
+ assert ( obj . anonymousClassWithPropName === '<Class anonymousClassWithPropName>' ) ;
156
+ assert ( obj [ '' ] === '<Class anonymous>' ) ;
128
157
} ) ;
129
158
} ) ;
130
159
You can’t perform that action at this time.
0 commit comments