Skip to content

Commit c953967

Browse files
LekoMylesBorins
authored andcommitted
test: increase diffie-hellman test coverage
PR-URL: #17728 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]>
1 parent 6d15185 commit c953967

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/parallel/test-crypto-dh.js

+22
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,28 @@ assert.strictEqual(secret2.toString('base64'), secret1);
2222
assert.strictEqual(dh1.verifyError, 0);
2323
assert.strictEqual(dh2.verifyError, 0);
2424

25+
{
26+
const DiffieHellman = crypto.DiffieHellman;
27+
const dh = DiffieHellman(p1, 'buffer');
28+
assert(dh instanceof DiffieHellman, 'DiffieHellman is expected to return a ' +
29+
'new instance when called without `new`');
30+
}
31+
32+
{
33+
const DiffieHellmanGroup = crypto.DiffieHellmanGroup;
34+
const dhg = DiffieHellmanGroup('modp5');
35+
assert(dhg instanceof DiffieHellmanGroup, 'DiffieHellmanGroup is expected ' +
36+
'to return a new instance when ' +
37+
'called without `new`');
38+
}
39+
40+
{
41+
const ECDH = crypto.ECDH;
42+
const ecdh = ECDH('prime256v1');
43+
assert(ecdh instanceof ECDH, 'ECDH is expected to return a new instance ' +
44+
'when called without `new`');
45+
}
46+
2547
[
2648
[0x1, 0x2],
2749
() => { },

0 commit comments

Comments
 (0)