0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-crypto-dh-group-setters.js
Tobias Nießen 92fb7dd818
test: simplify test-crypto-dh-group-setters
I can't tell why the test was written that way in the first place, but
it seems sufficient to check that setPrivateKey and setPublicKey are
both undefined.

Refs: https://github.com/nodejs/node-v0.x-archive/pull/2638
Refs: https://github.com/nodejs/node/pull/11253
PR-URL: https://github.com/nodejs/node/pull/49404
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-08-31 19:33:22 +00:00

14 lines
457 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const crypto = require('crypto');
// Unlike DiffieHellman, DiffieHellmanGroup does not have any setters.
const dhg = crypto.getDiffieHellman('modp1');
assert.strictEqual(dhg.constructor, crypto.DiffieHellmanGroup);
assert.strictEqual(dhg.setPrivateKey, undefined);
assert.strictEqual(dhg.setPublicKey, undefined);