diff --git a/test/parallel/test-crypto-dh-group-setters.js b/test/parallel/test-crypto-dh-group-setters.js index 38f78c158704b2..7c774111952ead 100644 --- a/test/parallel/test-crypto-dh-group-setters.js +++ b/test/parallel/test-crypto-dh-group-setters.js @@ -6,21 +6,8 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); -assert.throws( - function() { - crypto.getDiffieHellman('modp1').setPrivateKey(''); - }, - new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' + - 'setPrivateKey is not a function$'), - 'crypto.getDiffieHellman(\'modp1\').setPrivateKey(\'\') ' + - 'failed to throw the expected error.' -); -assert.throws( - function() { - crypto.getDiffieHellman('modp1').setPublicKey(''); - }, - new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' + - 'setPublicKey is not a function$'), - 'crypto.getDiffieHellman(\'modp1\').setPublicKey(\'\') ' + - 'failed to throw the expected error.' -); +// 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);