@@ -346,13 +346,17 @@ test('replacer removing all elements and indentation', function (assert) {
346346test ( 'array replacer' , function ( assert ) {
347347 const replacer = [ 'f' , 1 , null ]
348348 const obj = { f : null , null : true , 1 : false }
349- // The null element will be removed!
349+ // The null element will be ignored!
350+ // @ts -expect-error
350351 const expected = JSON . stringify ( obj , replacer )
352+ // @ts -expect-error
351353 let actual = stringify ( obj , replacer )
352354 assert . equal ( actual , expected )
353355
356+ // @ts -expect-error
354357 obj . f = obj
355358
359+ // @ts -expect-error
356360 actual = stringify ( { toJSON ( ) { return obj } } , replacer )
357361 assert . equal ( actual , expected . replace ( 'null' , '"[Circular]"' ) )
358362
@@ -374,7 +378,9 @@ test('array replacer and indentation', function (assert) {
374378 const replacer = [ 'f' , 1 , null ]
375379 const obj = { f : null , null : true , 1 : [ false , - Infinity , 't' ] }
376380 // The null element will be removed!
381+ // @ts -expect-error
377382 const expected = JSON . stringify ( obj , replacer , 2 )
383+ // @ts -expect-error
378384 const actual = stringify ( obj , replacer , 2 )
379385 assert . equal ( actual , expected )
380386 assert . end ( )
@@ -484,16 +490,16 @@ test('object with undefined values', function (assert) {
484490} )
485491
486492test ( 'undefined values and indented' , function ( assert ) {
487- let obj = { a : 1 , c : undefined , b : 'hello' }
493+ const obj1 = { a : 1 , c : undefined , b : 'hello' }
488494
489- let expected = JSON . stringify ( obj , null , 2 )
490- let actual = stringify ( obj , null , 2 )
495+ let expected = JSON . stringify ( obj1 , null , 2 )
496+ let actual = stringify ( obj1 , null , 2 )
491497 assert . equal ( actual , expected )
492498
493- obj = { b : 'hello' , a : undefined , c : 1 }
499+ const obj2 = { b : 'hello' , a : undefined , c : 1 }
494500
495- expected = JSON . stringify ( obj )
496- actual = stringify ( obj )
501+ expected = JSON . stringify ( obj2 )
502+ actual = stringify ( obj2 )
497503 assert . equal ( actual , expected )
498504
499505 assert . end ( )
@@ -516,6 +522,7 @@ test('bigint option', function (assert) {
516522 assert . equal ( actualBigInt , expectedBigInt )
517523 assert . equal ( actualDefault , expectedBigInt )
518524
525+ // @ts -expect-error
519526 assert . throws ( ( ) => stringify . configure ( { bigint : null } ) , / b i g i n t / )
520527
521528 assert . end ( )
@@ -620,11 +627,11 @@ test('non-deterministic with replacer', function (assert) {
620627 const keys = Object . keys ( obj )
621628
622629 const expected = stringify ( obj , [ 'b' , 'c' , 'd' , 'e' ] )
623- let actual = stringifyNonDeterministic ( obj , keys )
624- assert . equal ( actual , expected )
630+ const actualA = stringifyNonDeterministic ( obj , keys )
631+ assert . equal ( actualA , expected )
625632
626- actual = stringifyNonDeterministic ( obj , ( k , v ) => v )
627- assert . equal ( actual , expected )
633+ const actualB = stringifyNonDeterministic ( obj , ( k , v ) => v )
634+ assert . equal ( actualB , expected )
628635
629636 assert . end ( )
630637} )
@@ -654,20 +661,20 @@ test('check small typed arrays with extra properties', function (assert) {
654661 // @ts -expect-error
655662 obj . foo = true
656663 let expected = JSON . stringify ( obj )
657- let actual = stringify ( obj )
658- assert . equal ( actual , expected )
664+ const actualA = stringify ( obj )
665+ assert . equal ( actualA , expected )
659666
660667 expected = JSON . stringify ( obj , null , 2 )
661- actual = stringify ( obj , null , 2 )
662- assert . equal ( actual , expected )
668+ const actualB = stringify ( obj , null , 2 )
669+ assert . equal ( actualB , expected )
663670
664671 expected = JSON . stringify ( obj , [ 'foo' ] )
665- actual = stringify ( obj , [ 'foo' ] )
666- assert . equal ( actual , expected )
672+ const actualC = stringify ( obj , [ 'foo' ] )
673+ assert . equal ( actualC , expected )
667674
668675 expected = JSON . stringify ( obj , ( a , b ) => b )
669- actual = stringify ( obj , ( a , b ) => b )
670- assert . equal ( actual , expected )
676+ const actualD = stringify ( obj , ( a , b ) => b )
677+ assert . equal ( actualD , expected )
671678
672679 assert . end ( )
673680} )
@@ -972,26 +979,26 @@ test('show skipped keys even non were serliazable', (assert) => {
972979
973980 const input = { a : Symbol ( 'ignored' ) , b : Symbol ( 'ignored' ) }
974981
975- let actual = serialize ( input )
982+ const actual1 = serialize ( input )
976983 let expected = '{"...":"1 item not stringified"}'
977- assert . equal ( actual , expected )
984+ assert . equal ( actual1 , expected )
978985
979- actual = serialize ( input , ( a , b ) => b )
980- assert . equal ( actual , expected )
986+ const actual2 = serialize ( input , ( a , b ) => b )
987+ assert . equal ( actual2 , expected )
981988
982- actual = serialize ( input , null , 1 )
989+ const actual3 = serialize ( input , null , 1 )
983990 expected = '{\n "...": "1 item not stringified"\n}'
984- assert . equal ( actual , expected )
991+ assert . equal ( actual3 , expected )
985992
986- actual = serialize ( input , ( a , b ) => b , 1 )
987- assert . equal ( actual , expected )
993+ const actual4 = serialize ( input , ( a , b ) => b , 1 )
994+ assert . equal ( actual4 , expected )
988995
989- actual = serialize ( input , [ 'a' ] )
996+ const actual5 = serialize ( input , [ 'a' ] )
990997 expected = '{}'
991- assert . equal ( actual , expected )
998+ assert . equal ( actual5 , expected )
992999
993- actual = serialize ( input , [ 'a' , 'b' , 'c' ] )
994- assert . equal ( actual , expected )
1000+ const actual6 = serialize ( input , [ 'a' , 'b' , 'c' ] )
1001+ assert . equal ( actual6 , expected )
9951002
9961003 assert . end ( )
9971004} )
0 commit comments