Refactor prettyPrinter to work with immutable objects

[#50766813][#266]
This commit is contained in:
Greg Cobb and Luan Santos
2014-03-12 11:41:18 -07:00
parent 9e927af56e
commit c9e37a2a1c
4 changed files with 57 additions and 4 deletions

View File

@@ -63,6 +63,13 @@ describe("j$.pp", function () {
}
});
it("should stringify immutable circular objects", function(){
var frozenObject = {foo: {bar: 'baz'}};
frozenObject.circular = frozenObject;
frozenObject = Object.freeze(frozenObject);
expect(j$.pp(frozenObject)).toEqual("{ foo : { bar : 'baz' }, circular : <circular reference: Object> }");
});
it("should stringify RegExp objects properly", function() {
expect(j$.pp(/x|y|z/)).toEqual("/x|y|z/");
});