Skip to content

Commit d591750

Browse files
stropitekMylesBorins
authored andcommitted
test: change crypto decipheriv assertion messages
Includes problematic key and iv values into the assertion message PR-URL: #16007 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
1 parent 541866e commit d591750

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/parallel/test-crypto-cipheriv-decipheriv.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function testCipher1(key, iv) {
2020
let txt = decipher.update(ciph, 'hex', 'utf8');
2121
txt += decipher.final('utf8');
2222

23-
assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv');
23+
assert.strictEqual(txt, plaintext,
24+
`encryption/decryption with key ${key} and iv ${iv}`);
2425

2526
// streaming cipher interface
2627
// NB: In real life, it's not guaranteed that you can get all of it
@@ -34,7 +35,8 @@ function testCipher1(key, iv) {
3435
dStream.end(ciph);
3536
txt = dStream.read().toString('utf8');
3637

37-
assert.strictEqual(txt, plaintext, 'streaming cipher iv');
38+
assert.strictEqual(txt, plaintext,
39+
`streaming cipher with key ${key} and iv ${iv}`);
3840
}
3941

4042

@@ -52,7 +54,8 @@ function testCipher2(key, iv) {
5254
let txt = decipher.update(ciph, 'buffer', 'utf8');
5355
txt += decipher.final('utf8');
5456

55-
assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv');
57+
assert.strictEqual(txt, plaintext,
58+
`encryption/decryption with key ${key} and iv ${iv}`);
5659
}
5760

5861

@@ -71,7 +74,8 @@ function testCipher3(key, iv) {
7174
let deciph = decipher.update(ciph, 'buffer');
7275
deciph = Buffer.concat([deciph, decipher.final()]);
7376

74-
assert(deciph.equals(plaintext), 'encryption/decryption with key and iv');
77+
assert(deciph.equals(plaintext),
78+
`encryption/decryption with key ${key} and iv ${iv}`);
7579
}
7680

7781
testCipher1('0123456789abcd0123456789', '12345678');

0 commit comments

Comments
 (0)