From ccdee70bbe860db69aa0c4f491ad60567365b37a Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Wed, 20 Nov 2013 08:18:44 -0800 Subject: [PATCH] test for prototype of duplicated objects --- test/specs/jsdoc/util/doop.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/specs/jsdoc/util/doop.js b/test/specs/jsdoc/util/doop.js index e7275db3..07b16a30 100644 --- a/test/specs/jsdoc/util/doop.js +++ b/test/specs/jsdoc/util/doop.js @@ -44,6 +44,14 @@ describe('jsdoc/util/doop', function() { expect(inp).not.toBe(out); }); + it("should return an object with the same prototype as the original object", function() { + function Foo() {} + + var foo = new Foo(); + var bar = doop(foo); + expect( Object.getPrototypeOf(foo) ).toBe( Object.getPrototypeOf(bar) ); + }); + // checks that a === b if it's not an object or array (or it's af function); // otherwise recurses down into keys and compares them. function compareForEquality(a, b) {