@@ -331,7 +331,6 @@ describe('Extended JSON', function() {
331331 it . skip ( 'skipping 4.x/1.x interop tests' , ( ) => { } ) ;
332332 } else {
333333 it ( 'should interoperate 4.x with 1.x versions of this library' , function ( ) {
334-
335334 const buffer = Buffer . alloc ( 64 ) ;
336335 for ( var i = 0 ; i < buffer . length ; i ++ ) {
337336 buffer [ i ] = i ;
@@ -363,10 +362,11 @@ describe('Extended JSON', function() {
363362 oldObjectOldSerializer : OldBSON . serialize ( oldBsonObject , serializationOptions ) ,
364363 oldObjectNewSerializer : BSON . serialize ( oldBsonObject , serializationOptions ) ,
365364 newObjectOldSerializer : OldBSON . serialize ( newBsonObject , serializationOptions ) ,
366- newObjectNewSerializer : BSON . serialize ( newBsonObject , serializationOptions ) ,
365+ newObjectNewSerializer : BSON . serialize ( newBsonObject , serializationOptions )
367366 } ;
368367
369- const expectedBufferBase64 = 'VgEAAAViaW5hcnkAQAAAAAAAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/DWNvZGUADgAAAGZ1bmN0aW9uKCkge30AA2RiUmVmACwAAAACJHJlZgAGAAAAdGVzdHMAECRpZAABAAAAAiRkYgAFAAAAdGVzdAAAE2RlY2ltYWwxMjgA//837RjxE6AdAgAAAABAMAFkb3VibGUAMzMzMzMzJEAQaW50MzIACgAAABJsb25nAP//38RiSvoQf21heEtleQAHb2JqZWN0SWQAERERERERERERERERB29iamVjdElEABEREREREREREREREQtic29uUmVnRXhwAGhlbGxvIHdvcmxkAGkADnN5bWJvbAAHAAAAc3ltYm9sABF0aW1lc3RhbXAAAAAAAAAAAAAA' ;
368+ const expectedBufferBase64 =
369+ 'VgEAAAViaW5hcnkAQAAAAAAAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/DWNvZGUADgAAAGZ1bmN0aW9uKCkge30AA2RiUmVmACwAAAACJHJlZgAGAAAAdGVzdHMAECRpZAABAAAAAiRkYgAFAAAAdGVzdAAAE2RlY2ltYWwxMjgA//837RjxE6AdAgAAAABAMAFkb3VibGUAMzMzMzMzJEAQaW50MzIACgAAABJsb25nAP//38RiSvoQf21heEtleQAHb2JqZWN0SWQAERERERERERERERERB29iamVjdElEABEREREREREREREREQtic29uUmVnRXhwAGhlbGxvIHdvcmxkAGkADnN5bWJvbAAHAAAAc3ltYm9sABF0aW1lc3RhbXAAAAAAAAAAAAAA' ;
370370 const expectedBuffer = Buffer . from ( expectedBufferBase64 , 'base64' ) ;
371371
372372 // Regardless of which library version created the objects, and which library version
@@ -383,20 +383,28 @@ describe('Extended JSON', function() {
383383 const deserializationOptions = { promoteValues : false } ;
384384 const deserialized = {
385385 usingOldDeserializer : OldBSON . deserialize ( expectedBuffer , deserializationOptions ) ,
386- usingNewDeserializer : BSON . deserialize ( expectedBuffer , deserializationOptions ) ,
386+ usingNewDeserializer : BSON . deserialize ( expectedBuffer , deserializationOptions )
387387 } ;
388388 // Apparently the Symbol BSON type was deprecated in V4. Symbols in BSON are deserialized as strings in V4
389389 // Therefore, for this type we know there will be a difference between the V1 library and the V4 library,
390390 // so remove Symbol from the list of BSON types that are being compared.
391391 // Browser tests currently don't handle BSON Symbol correctly, so only test this under Node where OldBSON !=== BSON module.
392392 if ( BSON !== OldBSON ) {
393- expect ( deserialized . usingOldDeserializer [ 'symbol' ] . value ) . to . equal ( deserialized . usingNewDeserializer [ 'symbol' ] ) ;
393+ expect ( deserialized . usingOldDeserializer [ 'symbol' ] . value ) . to . equal (
394+ deserialized . usingNewDeserializer [ 'symbol' ]
395+ ) ;
394396 }
395397 delete deserialized . usingOldDeserializer [ 'symbol' ] ;
396398 delete deserialized . usingNewDeserializer [ 'symbol' ] ;
397399
398400 const ejsonExpected = {
399- binary : { $binary : { base64 : 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+Pw==' , subType : '00' } } ,
401+ binary : {
402+ $binary : {
403+ base64 :
404+ 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+Pw==' ,
405+ subType : '00'
406+ }
407+ } ,
400408 code : { $code : 'function() {}' } ,
401409 dbRef : { $ref : 'tests' , $id : { $numberInt : '1' } , $db : 'test' } ,
402410 decimal128 : { $numberDecimal : '9991223372036854775807' } ,
@@ -412,9 +420,15 @@ describe('Extended JSON', function() {
412420 timestamp : { $timestamp : { t : 0 , i : 0 } }
413421 } ;
414422 const ejsonSerializationOptions = { relaxed : false } ;
415- const resultOld = EJSON . serialize ( deserialized . usingOldDeserializer , ejsonSerializationOptions ) ;
423+ const resultOld = EJSON . serialize (
424+ deserialized . usingOldDeserializer ,
425+ ejsonSerializationOptions
426+ ) ;
416427 expect ( resultOld ) . to . deep . equal ( ejsonExpected ) ;
417- const resultNew = EJSON . serialize ( deserialized . usingNewDeserializer , ejsonSerializationOptions ) ;
428+ const resultNew = EJSON . serialize (
429+ deserialized . usingNewDeserializer ,
430+ ejsonSerializationOptions
431+ ) ;
418432 expect ( resultNew ) . to . deep . equal ( ejsonExpected ) ;
419433 } ) ;
420434
@@ -444,7 +458,7 @@ describe('Extended JSON', function() {
444458 oldObjectOldSerializer : OldBSON . serialize ( oldMinKey , serializationOptions ) ,
445459 oldObjectNewSerializer : BSON . serialize ( oldMinKey , serializationOptions ) ,
446460 newObjectOldSerializer : OldBSON . serialize ( newMinKey , serializationOptions ) ,
447- newObjectNewSerializer : BSON . serialize ( newMinKey , serializationOptions ) ,
461+ newObjectNewSerializer : BSON . serialize ( newMinKey , serializationOptions )
448462 } ;
449463
450464 expect ( expectedBufferMinKey ) . to . deep . equal ( bsonBuffersMinKey . newObjectNewSerializer ) ;
@@ -453,17 +467,23 @@ describe('Extended JSON', function() {
453467 expect ( expectedBufferMinKey ) . to . deep . equal ( bsonBuffersMinKey . oldObjectOldSerializer ) ;
454468
455469 const ejsonExpected = {
456- minKey : { $minKey : 1 } ,
470+ minKey : { $minKey : 1 }
457471 } ;
458472
459473 const deserialized = {
460474 usingOldDeserializer : OldBSON . deserialize ( expectedBufferMinKey , deserializationOptions ) ,
461- usingNewDeserializer : BSON . deserialize ( expectedBufferMinKey , deserializationOptions ) ,
475+ usingNewDeserializer : BSON . deserialize ( expectedBufferMinKey , deserializationOptions )
462476 } ;
463477 const ejsonSerializationOptions = { relaxed : false } ;
464- const resultOld = EJSON . serialize ( deserialized . usingOldDeserializer , ejsonSerializationOptions ) ;
478+ const resultOld = EJSON . serialize (
479+ deserialized . usingOldDeserializer ,
480+ ejsonSerializationOptions
481+ ) ;
465482 expect ( resultOld ) . to . deep . equal ( ejsonExpected ) ;
466- const resultNew = EJSON . serialize ( deserialized . usingNewDeserializer , ejsonSerializationOptions ) ;
483+ const resultNew = EJSON . serialize (
484+ deserialized . usingNewDeserializer ,
485+ ejsonSerializationOptions
486+ ) ;
467487 expect ( resultNew ) . to . deep . equal ( ejsonExpected ) ;
468488 } ) ;
469489 }
0 commit comments