summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-keyengine-invalid-arg-type.js
blob: 72fe526daffa8222c4e52aaa3be52b472dd618a9 (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
'use strict';
const common = require('../common');

if (!common.hasCrypto)
  common.skip('missing crypto');

const assert = require('assert');
const tls = require('tls');

assert.throws(
  () => {
    tls.createSecureContext({ privateKeyEngine: 0,
                              privateKeyIdentifier: 'key' });
  },
  { code: 'ERR_INVALID_ARG_TYPE',
    message: / Received type number \(0\)$/ });

assert.throws(
  () => {
    tls.createSecureContext({ privateKeyEngine: 'engine',
                              privateKeyIdentifier: 0 });
  },
  { code: 'ERR_INVALID_ARG_TYPE',
    message: / Received type number \(0\)$/ });