11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciif (!common.hasCrypto)
41cb0ef41Sopenharmony_ci  common.skip('missing crypto');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst assert = require('assert');
71cb0ef41Sopenharmony_ciconst crypto = require('crypto');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciassert.throws(
101cb0ef41Sopenharmony_ci  function() {
111cb0ef41Sopenharmony_ci    crypto.getDiffieHellman('modp1').setPrivateKey('');
121cb0ef41Sopenharmony_ci  },
131cb0ef41Sopenharmony_ci  new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
141cb0ef41Sopenharmony_ci  'setPrivateKey is not a function$'),
151cb0ef41Sopenharmony_ci  'crypto.getDiffieHellman(\'modp1\').setPrivateKey(\'\') ' +
161cb0ef41Sopenharmony_ci  'failed to throw the expected error.'
171cb0ef41Sopenharmony_ci);
181cb0ef41Sopenharmony_ciassert.throws(
191cb0ef41Sopenharmony_ci  function() {
201cb0ef41Sopenharmony_ci    crypto.getDiffieHellman('modp1').setPublicKey('');
211cb0ef41Sopenharmony_ci  },
221cb0ef41Sopenharmony_ci  new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
231cb0ef41Sopenharmony_ci  'setPublicKey is not a function$'),
241cb0ef41Sopenharmony_ci  'crypto.getDiffieHellman(\'modp1\').setPublicKey(\'\') ' +
251cb0ef41Sopenharmony_ci  'failed to throw the expected error.'
261cb0ef41Sopenharmony_ci);
27