mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
2d2986ae72
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
const tls = require('tls');
|
|
|
|
const dftProtocol = {};
|
|
|
|
// test for immutable `opts`
|
|
{
|
|
const opts = { foo: 'bar', NPNProtocols: [ 'http/1.1' ] };
|
|
const server = https.createServer(opts);
|
|
|
|
tls.convertNPNProtocols([ 'http/1.1' ], dftProtocol);
|
|
assert.deepStrictEqual(opts, { foo: 'bar', NPNProtocols: [ 'http/1.1' ] });
|
|
assert.strictEqual(server.NPNProtocols.compare(dftProtocol.NPNProtocols), 0);
|
|
}
|
|
|
|
|
|
// validate that `createServer` can work with the only argument requestListener
|
|
{
|
|
const mustNotCall = common.mustNotCall();
|
|
const server = https.createServer(mustNotCall);
|
|
|
|
tls.convertNPNProtocols([ 'http/1.1', 'http/1.0' ], dftProtocol);
|
|
assert.strictEqual(server.NPNProtocols.compare(dftProtocol.NPNProtocols), 0);
|
|
assert.strictEqual(server.listeners('request').length, 1);
|
|
assert.strictEqual(server.listeners('request')[0], mustNotCall);
|
|
}
|
|
|
|
|
|
// validate that `createServer` can work with no arguments
|
|
{
|
|
const server = https.createServer();
|
|
|
|
assert.strictEqual(server.NPNProtocols.compare(dftProtocol.NPNProtocols), 0);
|
|
assert.strictEqual(server.listeners('request').length, 0);
|
|
}
|