Last active
August 29, 2015 14:10
-
-
Save vaclavbohac/6bd41750c681f8624568 to your computer and use it in GitHub Desktop.
Revisions
-
vaclavbohac revised this gist
Nov 27, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,9 @@ describe('assert', function () { assert.deepEqual(actual, expected, 'Given objects are not deep equal.'); }); }); describe('#notDeepEqual()', function() { it('should handle cyclic references', function () { var actual = createCyclicReference('Harry Potter', 'Diagon Alley'), expected = createCyclicReference('Hermione Granger', 'Diagon Alley'); -
vaclavbohac created this gist
Nov 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ { "name": "cyclic-reference-example", "version": "1.0.0", "description": "Example of the cyclic reference example", "main": "index.js", "scripts": { "test": "mocha test" }, "author": "bohac.v@gmail.com", "license": "MIT", "dependencies": { "chai": "^1.10.0", "mocha": "^2.0.1" } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ var assert = require("chai").assert, createCyclicReference = function (name, place) { var customer = { name: name }; var address = { name: place }; customer.address = address; address.customer = customer; return customer; }; describe('assert', function () { describe('#deepEqual()', function () { it('should handle cyclic references', function () { var actual = createCyclicReference('Harry Potter', 'Diagon Alley'), expected = createCyclicReference('Harry Potter', 'Diagon Alley'); assert.deepEqual(actual, expected, 'Given objects are not deep equal.'); }); it('should handle cyclic references', function () { var actual = createCyclicReference('Harry Potter', 'Diagon Alley'), expected = createCyclicReference('Hermione Granger', 'Diagon Alley'); assert.notDeepEqual(actual, expected, 'Given objects are not deep equal.'); }); }); });