Skip to content

Commit 24d7294

Browse files
corvinrokjoyeecheung
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 4e835b3 commit 24d7294

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
@@ -372,15 +372,13 @@ if (!common.hasFipsCrypto) {
372372
const a0 = crypto.createHash('md5').update('Test123').digest('latin1');
373373
assert.strictEqual(
374374
a0,
375-
'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c',
376-
'Test MD5 as latin1'
375+
'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c'
377376
);
378377
}
379378

380-
assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1');
379+
assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2');
381380

382-
assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=',
383-
'Test SHA256 as base64');
381+
assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=');
384382

385383
assert.strictEqual(
386384
a3,
@@ -394,14 +392,13 @@ assert.strictEqual(
394392

395393
assert.deepStrictEqual(
396394
a4,
397-
Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex'),
398-
'Test SHA1'
395+
Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex')
399396
);
400397

401398
// Test multiple updates to same hash
402399
const h1 = crypto.createHash('sha1').update('Test123').digest('hex');
403400
const h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex');
404-
assert.strictEqual(h1, h2, 'multipled updates');
401+
assert.strictEqual(h1, h2);
405402

406403
// Test hashing for binary files
407404
const fn = fixtures.path('sample.png');
@@ -413,8 +410,7 @@ fileStream.on('data', function(data) {
413410
fileStream.on('close', common.mustCall(function() {
414411
assert.strictEqual(
415412
sha1Hash.digest('hex'),
416-
'22723e553129a336ad96e10f6aecdf0f45e4149e',
417-
'Test SHA1 of sample.png'
413+
'22723e553129a336ad96e10f6aecdf0f45e4149e'
418414
);
419415
}));
420416

@@ -431,7 +427,7 @@ const s1Verified = crypto.createVerify('SHA1')
431427
.update('Test')
432428
.update('123')
433429
.verify(certPem, s1, 'base64');
434-
assert.strictEqual(s1Verified, true, 'sign and verify (base 64)');
430+
assert.strictEqual(s1Verified, true);
435431

436432
const s2 = crypto.createSign('SHA256')
437433
.update('Test123')
@@ -440,7 +436,7 @@ const s2Verified = crypto.createVerify('SHA256')
440436
.update('Test')
441437
.update('123')
442438
.verify(certPem, s2); // binary
443-
assert.strictEqual(s2Verified, true, 'sign and verify (binary)');
439+
assert.strictEqual(s2Verified, true);
444440

445441
const s3 = crypto.createSign('SHA1')
446442
.update('Test123')
@@ -449,7 +445,7 @@ const s3Verified = crypto.createVerify('SHA1')
449445
.update('Test')
450446
.update('123')
451447
.verify(certPem, s3);
452-
assert.strictEqual(s3Verified, true, 'sign and verify (buffer)');
448+
assert.strictEqual(s3Verified, true);
453449

454450

455451
function testCipher1(key) {
@@ -467,7 +463,7 @@ function testCipher1(key) {
467463
let txt = decipher.update(ciph, 'hex', 'utf8');
468464
txt += decipher.final('utf8');
469465

470-
assert.strictEqual(txt, plaintext, 'encryption and decryption');
466+
assert.strictEqual(txt, plaintext);
471467
}
472468

473469

@@ -489,7 +485,7 @@ function testCipher2(key) {
489485
let txt = decipher.update(ciph, 'base64', 'utf8');
490486
txt += decipher.final('utf8');
491487

492-
assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64');
488+
assert.strictEqual(txt, plaintext);
493489
}
494490

495491

@@ -507,8 +503,7 @@ function testCipher3(key, iv) {
507503
let txt = decipher.update(ciph, 'hex', 'utf8');
508504
txt += decipher.final('utf8');
509505

510-
assert.strictEqual(txt, plaintext,
511-
'encryption and decryption with key and iv');
506+
assert.strictEqual(txt, plaintext);
512507
}
513508

514509

@@ -526,8 +521,7 @@ function testCipher4(key, iv) {
526521
let txt = decipher.update(ciph, 'buffer', 'utf8');
527522
txt += decipher.final('utf8');
528523

529-
assert.strictEqual(txt, plaintext,
530-
'encryption and decryption with key and iv');
524+
assert.strictEqual(txt, plaintext);
531525
}
532526

533527

@@ -545,8 +539,7 @@ function testCipher5(key, iv) {
545539
let txt = decipher.update(ciph, 'buffer', 'utf8');
546540
txt += decipher.final('utf8');
547541

548-
assert.strictEqual(txt, plaintext,
549-
'encryption and decryption with key');
542+
assert.strictEqual(txt, plaintext);
550543
}
551544

552545
if (!common.hasFipsCrypto) {

0 commit comments

Comments
 (0)