diff --git a/test/lib/core/utils.test.js b/test/lib/core/utils.test.js index 623e9c2697..35683ab8f6 100644 --- a/test/lib/core/utils.test.js +++ b/test/lib/core/utils.test.js @@ -125,6 +125,35 @@ describe('test/lib/core/utils.test.js', () => { assert(obj.undefined$ === undefined); assert(obj.boolean$ === ''); assert(obj.symbol$ === ''); + assert(obj.regexp$ === ''); + }); + + it('should convert a plain recursive object', () => { + const obj = { + plainObj: 'Plain', + Id: 1, + recurisiveObj: { + value1: 'string', + value2: 1, + ignoreValue: /^[a-z]/, + }, + }; + utils.convertObject(obj, [ 'ignoreValue' ]); + assert(obj.recurisiveObj.value1 === 'string'); + assert(obj.recurisiveObj.value2 === 1); + assert(obj.recurisiveObj.ignoreValue === ''); + assert(obj.plainObj === 'Plain'); + assert(obj.Id === 1); + }); + + it('should convert an anonymous class', () => { + const obj = { + anonymousClassWithPropName: class { }, + '': class { }, + }; + utils.convertObject(obj); + assert(obj.anonymousClassWithPropName === ''); + assert(obj[''] === ''); }); });