summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-server-settimeout-no-callback.js
blob: cdea67f4e87d1eb5c80a5f5535665fa36c2afcbd (plain)
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
35
36
37
38
39
40
41
'use strict';

const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

const http2 = require('http2');

// Verify that setTimeout callback verifications work correctly

{
  const server = http2.createServer();
  common.expectsError(
    () => server.setTimeout(10, 'test'),
    {
      code: 'ERR_INVALID_CALLBACK',
      type: TypeError
    });
  common.expectsError(
    () => server.setTimeout(10, 1),
    {
      code: 'ERR_INVALID_CALLBACK',
      type: TypeError
    });
}

{
  const server = http2.createSecureServer({});
  common.expectsError(
    () => server.setTimeout(10, 'test'),
    {
      code: 'ERR_INVALID_CALLBACK',
      type: TypeError
    });
  common.expectsError(
    () => server.setTimeout(10, 1),
    {
      code: 'ERR_INVALID_CALLBACK',
      type: TypeError
    });
}