test for prototype of duplicated objects

This commit is contained in:
Jeff Williams 2013-11-20 08:18:44 -08:00
parent 6b62beb055
commit ccdee70bbe

View File

@ -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) {