@@ -316,6 +316,21 @@ describe('Built-in transforms', function () {
316316 assert . strictEqual ( actualView [ 1 ] , 2000 ) ;
317317 } ) ;
318318
319+ it ( 'Should transform Buffer' , function ( ) {
320+ if ( typeof Buffer !== 'function' )
321+ return ;
322+
323+ var buffer = Buffer . from ( [ 3 , 5 ] ) ;
324+
325+ var actual = replicator . decode ( replicator . encode ( buffer ) ) ;
326+
327+ assert ( actual instanceof Buffer ) ;
328+ assert . strictEqual ( actual . length , 2 ) ;
329+
330+ assert . strictEqual ( actual [ 0 ] , 3 ) ;
331+ assert . strictEqual ( actual [ 1 ] , 5 ) ;
332+ } ) ;
333+
319334 it ( 'Should transform TypedArray' , function ( ) {
320335 var actual = replicator . decode ( replicator . encode ( {
321336 uint8 : new Uint8Array ( [ 1 , 230 ] ) ,
@@ -405,13 +420,13 @@ describe('Regression', function () {
405420 obj . ans = 42 ;
406421
407422 var actual = replicator . decode ( replicator . encode ( obj ) ) ;
408-
423+
409424 assert . strictEqual ( actual . foo , 'bar' ) ;
410425 assert . strictEqual ( actual . ans , 42 ) ;
411426 } ) ;
412427
413428 it ( 'Should not allow RCE when deserializing TypedArrays' , function ( ) {
414- replicator . decode ( helpersGH16 . vulnerableData ) ;
429+ replicator . decode ( helpersGH16 . vulnerableData ) ;
415430
416431 return helpersGH16 . checkIfBroken ( )
417432 . then ( function ( result ) {
0 commit comments