@@ -99,6 +99,10 @@ describe('javascript-stringify', function () {
9999 describe ( 'Error' , function ( ) {
100100 it ( 'should stringify' , test ( new Error ( 'test' ) , "new Error('test')" ) ) ;
101101 } ) ;
102+
103+ describe ( 'unknown native type' , function ( ) {
104+ it ( 'should be omitted' , test ( { k : process } , '{}' ) ) ;
105+ } ) ;
102106 } ) ;
103107
104108 describe ( 'ES6' , function ( ) {
@@ -183,6 +187,18 @@ describe('javascript-stringify', function () {
183187
184188 expect ( result ) . to . equal ( '(function(){var x={a:{}};x.b=x.a;return x;}())' ) ;
185189 } ) ;
190+
191+ it ( 'should restore repeated values with indentation' , function ( ) {
192+ var obj = { }
193+ var child = { } ;
194+
195+ obj . a = child ;
196+ obj . b = child ;
197+
198+ var result = stringify ( obj , null , 2 , { references : true } )
199+
200+ expect ( result ) . to . equal ( '(function () {\nvar x = {\n a: {}\n};\nx.b = x.a;\nreturn x;\n}())' ) ;
201+ } ) ;
186202 } ) ;
187203
188204 describe ( 'custom spaces' , function ( ) {
@@ -299,5 +315,10 @@ describe('javascript-stringify', function () {
299315 'should get part of the object' ,
300316 test ( obj , '{a:{b:{}}}' , null , { maxDepth : 2 } )
301317 ) ;
318+
319+ it (
320+ 'should get part of the object when tracking references' ,
321+ test ( obj , '{a:{b:{}}}' , null , { maxDepth : 2 , references : true } )
322+ ) ;
302323 } ) ;
303324} ) ;
0 commit comments