diff --git a/src/context/context.spec.ts b/src/context/context.spec.ts index 2692b0704..b7e182e5b 100644 --- a/src/context/context.spec.ts +++ b/src/context/context.spec.ts @@ -138,6 +138,11 @@ describe('Context', function () { ctx.push({ foo: [] }) return expect(ctx.getSync(['foo', 'reduce'])).toEqual(undefined) }) + it('should return undefined for typical Object.prototype properties (e.g. constructor, valueOf)', function () { + ctx.push({ obj: {} }) + expect(ctx.getSync(['obj', 'constructor'])).toEqual(undefined) + expect(ctx.getSync(['obj', 'valueOf'])).toEqual(undefined) + }) it('should return undefined for function prototype property', function () { function Foo () {} Foo.prototype.bar = 'BAR' @@ -216,17 +221,4 @@ describe('Context', function () { expect(ctx.getSync(['foo'])).toEqual('zoo') }) }) - describe('scope storage', function () { - it('should not treat Object.prototype properties as implicit keys on bottom scope', function () { - const bottom = new Context().bottom() as Record - expect('toString' in bottom).toBe(false) - expect('hasOwnProperty' in bottom).toBe(false) - }) - it('should merge into a scope result without implicit Object.prototype keys', function () { - const all = new Context({ a: 1 }).getAll() as Record - expect(all.a).toBe(1) - expect('toString' in all).toBe(false) - expect('hasOwnProperty' in all).toBe(false) - }) - }) })