diff --git a/src/tests/object.test.ts b/src/tests/object.test.ts index 4f2ee7f0f..e43e65554 100644 --- a/src/tests/object.test.ts +++ b/src/tests/object.test.ts @@ -445,6 +445,15 @@ describe('object module', () => { const result = _.assign({}, { b: 'y' }) expect(result).toEqual({ b: 'y' }) }) + test('works with Object.create(null)', () => { + const object = { a: Object.create(null) } + object.a.b = 1 + + const result = _.assign(object, { a: { c: 2 } }) + + expect(result).toEqual({ a: { b: 1, c: 2 } }) + expect(Object.getPrototypeOf(result.a)).toBe(null) + }) }) describe('keys function', () => { @@ -477,6 +486,14 @@ describe('object module', () => { 'enemies.0.power' ]) }) + test('works with Object.create(null)', () => { + const object = Object.create(null) + object.a = 1 + object.b = [2] + object.c = { d: 3 } + const result = _.keys(object) + expect(result).toEqual(['a', 'b.0', 'c.d']) + }) }) describe('set function', () => {