@@ -362,8 +362,7 @@ for (var i in TEST_CASES) {
362
362
( function ( ) {
363
363
if ( ! test . password ) return ;
364
364
if ( common . hasFipsCrypto ) {
365
- assert . throws ( function ( )
366
- { crypto . createCipher ( test . algo , test . password ) ; } ,
365
+ assert . throws ( ( ) => { crypto . createCipher ( test . algo , test . password ) ; } ,
367
366
/ n o t s u p p o r t e d i n F I P S m o d e / ) ;
368
367
} else {
369
368
var encrypt = crypto . createCipher ( test . algo , test . password ) ;
@@ -383,8 +382,7 @@ for (var i in TEST_CASES) {
383
382
( function ( ) {
384
383
if ( ! test . password ) return ;
385
384
if ( common . hasFipsCrypto ) {
386
- assert . throws ( function ( )
387
- { crypto . createDecipher ( test . algo , test . password ) ; } ,
385
+ assert . throws ( ( ) => { crypto . createDecipher ( test . algo , test . password ) ; } ,
388
386
/ n o t s u p p o r t e d i n F I P S m o d e / ) ;
389
387
} else {
390
388
var decrypt = crypto . createDecipher ( test . algo , test . password ) ;
@@ -415,9 +413,9 @@ for (var i in TEST_CASES) {
415
413
'ipxp9a6i1Mb4USb4' , '6fKjEjR3Vl30EUYC' ) ;
416
414
encrypt . update ( 'blah' , 'ascii' ) ;
417
415
encrypt . final ( ) ;
418
- assert . throws ( function ( ) { encrypt . getAuthTag ( ) ; } , / s t a t e / ) ;
419
- assert . throws ( function ( ) {
420
- encrypt . setAAD ( new Buffer ( '123' , 'ascii' ) ) ; } , / s t a t e / ) ;
416
+ assert . throws ( ( ) => { encrypt . getAuthTag ( ) ; } , / s t a t e / ) ;
417
+ assert . throws ( ( ) => { encrypt . setAAD ( Buffer . from ( '123' , 'ascii' ) ) ; } ,
418
+ / s t a t e / ) ;
421
419
} ) ( ) ;
422
420
423
421
( function ( ) {
@@ -431,9 +429,9 @@ for (var i in TEST_CASES) {
431
429
( function ( ) {
432
430
// trying to set tag on encryption object:
433
431
var encrypt = crypto . createCipheriv ( test . algo ,
434
- new Buffer ( test . key , 'hex' ) , new Buffer ( test . iv , 'hex' ) ) ;
435
- assert . throws ( function ( ) {
436
- encrypt . setAuthTag ( new Buffer ( test . tag , 'hex' ) ) ; } , / s t a t e / ) ;
432
+ Buffer . from ( test . key , 'hex' ) , Buffer . from ( test . iv , 'hex' ) ) ;
433
+ assert . throws ( ( ) => { encrypt . setAuthTag ( Buffer . from ( test . tag , 'hex' ) ) ; } ,
434
+ / s t a t e / ) ;
437
435
} ) ( ) ;
438
436
439
437
( function ( ) {
0 commit comments