Skip to content

Commit

Permalink
failing circular map scrub test
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jun 6, 2011
1 parent d4a7710 commit 9f36635
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/circular.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,19 @@ exports.circClone = function () {
assert.deepEqual(clone.x.slice(0,3), [1,2,3]);
assert.deepEqual(clone.y.slice(0,2), [4,5]);
};

exports.circMapScrub = function () {
var obj = { a : 1, b : 2 };
obj.c = obj;

var scrubbed = Traverse(obj).map(function (node) {
if (this.circular) this.remove();
});
assert.deepEqual(
Object.keys(scrubbed).sort(),
[ 'a', 'b' ]
);
Traverse.deepEqual(scrubbed, { a : 1, b : 2 });

assert.equal(obj.c, obj);
};

0 comments on commit 9f36635

Please sign in to comment.