-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Expand file tree
/
Copy pathtest-tls-ticket-invalid-arg.js
More file actions
34 lines (30 loc) · 934 Bytes
/
test-tls-ticket-invalid-arg.js
File metadata and controls
34 lines (30 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
const common = require('../common');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const assert = require('assert');
const tls = require('tls');
const server = new tls.Server();
[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, '', () => {}]
.forEach((arg) =>
assert.throws(
() => server.setTicketKeys(arg),
{
name: 'TypeError',
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "buffer" argument must be an instance of Buffer, TypedArray, or DataView.' +
common.invalidArgTypeHelper(arg),
}
));
[new Uint8Array(1), Buffer.from([1]), new DataView(new ArrayBuffer(2))].forEach(
(arg) =>
assert.throws(
() => server.setTicketKeys(arg),
{
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE',
message: `The argument 'keys' must be exactly 48 bytes. Received ${arg.byteLength}`,
}
)
);