diff --git a/index.js b/index.js index 3cfdf34..552f0d2 100644 --- a/index.js +++ b/index.js @@ -178,8 +178,8 @@ function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) { } // Temporarily set the operands in the memoize object to prevent blowing the stack - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false); - memoizeSet(rightHandOperand, leftHandOperand, options.memoize, false); + memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true); + memoizeSet(rightHandOperand, leftHandOperand, options.memoize, true); var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options); memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result); diff --git a/test/index.js b/test/index.js index 49d289a..0fd8e8a 100644 --- a/test/index.js +++ b/test/index.js @@ -316,13 +316,13 @@ describe('Generic', function () { assert(eql({ foo: 'bar' }, { bar: 'baz' }) === false, 'eql({ foo: "bar" }, { foo: "baz" }) === false'); }); - it('returns false with recursive objects of differing values', function () { + it('returns true with circular objects', function () { var objectA = { foo: 1 }; var objectB = { foo: 1 }; objectA.bar = objectB; objectB.bar = objectA; - assert(eql(objectA, objectB) === false, - 'eql({ foo: 1, bar: -> }, { foo: 1, bar: <- }) === false'); + assert(eql(objectA, objectB) === true, + 'eql({ foo: 1, bar: -> }, { foo: 1, bar: <- }) === true'); }); it('returns false with objects with deeply unequal prototypes', function () { diff --git a/test/new-ecmascript-types.js b/test/new-ecmascript-types.js index 96f343c..7c28b95 100644 --- a/test/new-ecmascript-types.js +++ b/test/new-ecmascript-types.js @@ -231,12 +231,12 @@ describe('ES2015 Specific', function () { assert(eql(setA, setB) === false, 'eql(Set { "a", "b", "c" }, Set { "d", "e", "f" }) === false'); }); - it('returns false for Sets with different circular references', function () { + it('returns true for circular Sets', function () { var setA = new Set(); var setB = new Set(); setA.add(setB); setB.add(setA); - assert(eql(setA, setB) === false, 'eql(Set { -> }, Set { <- }) === false'); + assert(eql(setA, setB) === true, 'eql(Set { -> }, Set { <- }) === true'); }); });