node/test/parallel/test-net-server-connections.js
Rich Trott 97f001ab16 test,net: add tests for server.connections
There were no tests confirming situations where server.connections
should return `null`. Add a test for that situation.

Expand existing server.connection test slightly to check value.

Refactor (mostly spacing) code for server.connections setter.

PR-URL: https://github.com/nodejs/node/pull/10762
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-14 20:57:26 -08:00

19 lines
575 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const net = require('net');
const server = new net.Server();
const expectedWarning = 'Server.connections property is deprecated. ' +
'Use Server.getConnections method instead.';
common.expectWarning('DeprecationWarning', expectedWarning);
// test that server.connections property is no longer enumerable now that it
// has been marked as deprecated
assert.strictEqual(Object.keys(server).indexOf('connections'), -1);
assert.strictEqual(server.connections, 0);