Skip to content

Commit f46e118

Browse files
corvinrokMylesBorins
authored andcommitted
test: remove error messages in crypto-binary test
PR-URL: #15981 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 086d851 commit f46e118

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

test/parallel/test-crypto-binary-default.js

+14-21
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,13 @@ if (!common.hasFipsCrypto) {
351351
const a0 = crypto.createHash('md5').update('Test123').digest('latin1');
352352
assert.strictEqual(
353353
a0,
354-
'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c',
355-
'Test MD5 as latin1'
354+
'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c'
356355
);
357356
}
358357

359-
assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1');
358+
assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2');
360359

361-
assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=',
362-
'Test SHA256 as base64');
360+
assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=');
363361

364362
assert.strictEqual(
365363
a3,
@@ -373,14 +371,13 @@ assert.strictEqual(
373371

374372
assert.deepStrictEqual(
375373
a4,
376-
Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex'),
377-
'Test SHA1'
374+
Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex')
378375
);
379376

380377
// Test multiple updates to same hash
381378
const h1 = crypto.createHash('sha1').update('Test123').digest('hex');
382379
const h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex');
383-
assert.strictEqual(h1, h2, 'multipled updates');
380+
assert.strictEqual(h1, h2);
384381

385382
// Test hashing for binary files
386383
const fn = fixtures.path('sample.png');
@@ -392,8 +389,7 @@ fileStream.on('data', function(data) {
392389
fileStream.on('close', common.mustCall(function() {
393390
assert.strictEqual(
394391
sha1Hash.digest('hex'),
395-
'22723e553129a336ad96e10f6aecdf0f45e4149e',
396-
'Test SHA1 of sample.png'
392+
'22723e553129a336ad96e10f6aecdf0f45e4149e'
397393
);
398394
}));
399395

@@ -410,7 +406,7 @@ const s1Verified = crypto.createVerify('SHA1')
410406
.update('Test')
411407
.update('123')
412408
.verify(certPem, s1, 'base64');
413-
assert.strictEqual(s1Verified, true, 'sign and verify (base 64)');
409+
assert.strictEqual(s1Verified, true);
414410

415411
const s2 = crypto.createSign('SHA256')
416412
.update('Test123')
@@ -419,7 +415,7 @@ const s2Verified = crypto.createVerify('SHA256')
419415
.update('Test')
420416
.update('123')
421417
.verify(certPem, s2); // binary
422-
assert.strictEqual(s2Verified, true, 'sign and verify (binary)');
418+
assert.strictEqual(s2Verified, true);
423419

424420
const s3 = crypto.createSign('SHA1')
425421
.update('Test123')
@@ -428,7 +424,7 @@ const s3Verified = crypto.createVerify('SHA1')
428424
.update('Test')
429425
.update('123')
430426
.verify(certPem, s3);
431-
assert.strictEqual(s3Verified, true, 'sign and verify (buffer)');
427+
assert.strictEqual(s3Verified, true);
432428

433429

434430
function testCipher1(key) {
@@ -446,7 +442,7 @@ function testCipher1(key) {
446442
let txt = decipher.update(ciph, 'hex', 'utf8');
447443
txt += decipher.final('utf8');
448444

449-
assert.strictEqual(txt, plaintext, 'encryption and decryption');
445+
assert.strictEqual(txt, plaintext);
450446
}
451447

452448

@@ -468,7 +464,7 @@ function testCipher2(key) {
468464
let txt = decipher.update(ciph, 'base64', 'utf8');
469465
txt += decipher.final('utf8');
470466

471-
assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64');
467+
assert.strictEqual(txt, plaintext);
472468
}
473469

474470

@@ -486,8 +482,7 @@ function testCipher3(key, iv) {
486482
let txt = decipher.update(ciph, 'hex', 'utf8');
487483
txt += decipher.final('utf8');
488484

489-
assert.strictEqual(txt, plaintext,
490-
'encryption and decryption with key and iv');
485+
assert.strictEqual(txt, plaintext);
491486
}
492487

493488

@@ -505,8 +500,7 @@ function testCipher4(key, iv) {
505500
let txt = decipher.update(ciph, 'buffer', 'utf8');
506501
txt += decipher.final('utf8');
507502

508-
assert.strictEqual(txt, plaintext,
509-
'encryption and decryption with key and iv');
503+
assert.strictEqual(txt, plaintext);
510504
}
511505

512506

@@ -524,8 +518,7 @@ function testCipher5(key, iv) {
524518
let txt = decipher.update(ciph, 'buffer', 'utf8');
525519
txt += decipher.final('utf8');
526520

527-
assert.strictEqual(txt, plaintext,
528-
'encryption and decryption with key');
521+
assert.strictEqual(txt, plaintext);
529522
}
530523

531524
if (!common.hasFipsCrypto) {

0 commit comments

Comments
 (0)