Skip to content

Commit f900753

Browse files
michael6Fishrock123
authored andcommitted
test: refactor test-crypto-ecb
* var -> const/let * IIFE to blocks PR-URL: #10029 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 6502427 commit f900753

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

‎test/parallel/test-crypto-ecb.js‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2-
varcommon=require('../common');
3-
varassert=require('assert');
2+
constcommon=require('../common');
3+
constassert=require('assert');
44

55
if(!common.hasCrypto){
66
common.skip('missing crypto');
@@ -10,24 +10,25 @@ if (common.hasFipsCrypto){
1010
common.skip('BF-ECB is not FIPS 140-2 compatible');
1111
return;
1212
}
13-
varcrypto=require('crypto');
13+
constcrypto=require('crypto');
1414

1515
crypto.DEFAULT_ENCODING='buffer';
1616

1717
// Testing whether EVP_CipherInit_ex is functioning correctly.
1818
// Reference: bug#1997
1919

20-
(function(){
21-
varencrypt=crypto.createCipheriv('BF-ECB','SomeRandomBlahz0c5GZVnR','');
22-
varhex=encrypt.update('Hello World!','ascii','hex');
20+
{
21+
constencrypt=
22+
crypto.createCipheriv('BF-ECB','SomeRandomBlahz0c5GZVnR','');
23+
lethex=encrypt.update('Hello World!','ascii','hex');
2324
hex+=encrypt.final('hex');
2425
assert.strictEqual(hex.toUpperCase(),'6D385F424AAB0CFBF0BB86E07FFB7D71');
25-
}());
26+
}
2627

27-
(function(){
28-
vardecrypt=crypto.createDecipheriv('BF-ECB','SomeRandomBlahz0c5GZVnR',
29-
'');
30-
varmsg=decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71','hex','ascii');
28+
{
29+
constdecrypt=
30+
crypto.createDecipheriv('BF-ECB','SomeRandomBlahz0c5GZVnR','');
31+
letmsg=decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71','hex','ascii');
3132
msg+=decrypt.final('ascii');
3233
assert.strictEqual(msg,'Hello World!');
33-
}());
34+
}

0 commit comments

Comments
(0)