-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: check options to create{Server,SecureContext}
Introduce a new test to validate the options being passed to `createServer` and `createSecureContext`. PR-URL: #3100
- Loading branch information
1 parent
001e88f
commit d9dabd2
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
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/); |