summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-hmac.js
diff options
context:
space:
mode:
authoreudaimos <jeff@hwgray.com>2016-12-01 10:25:58 -0600
committerRich Trott <rtrott@gmail.com>2016-12-07 21:08:37 -0800
commit1e4b9a1450d94bb7e45bcecc772e69638b6f10a3 (patch)
tree89d6c5a9f7f94bbc8a0c3e5e7edffd48304c43a4 /test/parallel/test-crypto-hmac.js
parent68488e9c75cf24632fd68063168992ca6830655c (diff)
downloadandroid-node-v8-1e4b9a1450d94bb7e45bcecc772e69638b6f10a3.tar.gz
android-node-v8-1e4b9a1450d94bb7e45bcecc772e69638b6f10a3.tar.bz2
android-node-v8-1e4b9a1450d94bb7e45bcecc772e69638b6f10a3.zip
test: refactor test-crypto-hmac
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: https://github.com/nodejs/node/pull/9958 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-crypto-hmac.js')
-rw-r--r--test/parallel/test-crypto-hmac.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js
index 7c550be4c2..5307ea4f6f 100644
--- a/test/parallel/test-crypto-hmac.js
+++ b/test/parallel/test-crypto-hmac.js
@@ -13,7 +13,7 @@ var h1 = crypto.createHmac('sha1', 'Node')
.update('some data')
.update('to hmac')
.digest('hex');
-assert.equal(h1, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC');
+assert.strictEqual(h1, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC');
// Test HMAC (Wikipedia Test Cases)
var wikipedia = [
@@ -67,9 +67,9 @@ for (let i = 0, l = wikipedia.length; i < l; i++) {
const result = crypto.createHmac(hash, wikipedia[i]['key'])
.update(wikipedia[i]['data'])
.digest('hex');
- assert.equal(wikipedia[i]['hmac'][hash],
- result,
- 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' wikipedia');
+ assert.strictEqual(wikipedia[i]['hmac'][hash],
+ result,
+ `Test HMAC-${hash}: Test case ${i + 1} wikipedia`);
}
}
@@ -233,10 +233,10 @@ for (let i = 0, l = rfc4231.length; i < l; i++) {
result = result.substr(0, 32); // first 128 bits == 32 hex chars
strRes = strRes.substr(0, 32);
}
- assert.equal(rfc4231[i]['hmac'][hash],
- result,
- 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' rfc 4231');
- assert.equal(strRes, result, 'Should get same result from stream');
+ assert.strictEqual(rfc4231[i]['hmac'][hash],
+ result,
+ `Test HMAC-${hash}: Test case ${i + 1} rfc 4231`);
+ assert.strictEqual(strRes, result, 'Should get same result from stream');
}
}
@@ -356,7 +356,7 @@ if (!common.hasFipsCrypto) {
crypto.createHmac('md5', rfc2202_md5[i]['key'])
.update(rfc2202_md5[i]['data'])
.digest('hex'),
- 'Test HMAC-MD5 : Test case ' + (i + 1) + ' rfc 2202'
+ `Test HMAC-MD5 : Test case ${i + 1} rfc 2202`
);
}
}
@@ -366,6 +366,6 @@ for (let i = 0, l = rfc2202_sha1.length; i < l; i++) {
crypto.createHmac('sha1', rfc2202_sha1[i]['key'])
.update(rfc2202_sha1[i]['data'])
.digest('hex'),
- 'Test HMAC-SHA1 : Test case ' + (i + 1) + ' rfc 2202'
+ `Test HMAC-SHA1 : Test case ${i + 1} rfc 2202`
);
}