mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 12:54:43 +00:00

Fix running the tests when node was compiled without crypto
support. Some of these are cleanup after 52bae222a3
, where
common was used before it was required.
PR-URL: https://github.com/nodejs/node/pull/7056
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const tls = require('tls');
|
|
|
|
assert.throws(() => tls.createSecureContext({ciphers: 1}),
|
|
/TypeError: Ciphers must be a string/);
|
|
|
|
assert.throws(() => tls.createServer({ciphers: 1}),
|
|
/TypeError: Ciphers must be a string/);
|
|
|
|
assert.throws(() => tls.createSecureContext({key: 'dummykey', passphrase: 1}),
|
|
/TypeError: Pass phrase must be a string/);
|
|
|
|
assert.throws(() => tls.createServer({key: 'dummykey', passphrase: 1}),
|
|
/TypeError: Pass phrase must be a string/);
|
|
|
|
assert.throws(() => tls.createServer({ecdhCurve: 1}),
|
|
/TypeError: ECDH curve name must be a string/);
|
|
|
|
assert.throws(() => tls.createServer({handshakeTimeout: 'abcd'}),
|
|
/TypeError: handshakeTimeout must be a number/);
|
|
|
|
assert.throws(() => tls.createServer({sessionTimeout: 'abcd'}),
|
|
/TypeError: Session timeout must be a 32-bit integer/);
|
|
|
|
assert.throws(() => tls.createServer({ticketKeys: 'abcd'}),
|
|
/TypeError: Ticket keys must be a buffer/);
|
|
|
|
assert.throws(() => tls.createServer({ticketKeys: new Buffer(0)}),
|
|
/TypeError: Ticket keys length must be 48 bytes/);
|
|
|
|
assert.throws(() => tls.createSecurePair({}),
|
|
/Error: First argument must be a tls module SecureContext/);
|