diff options
author | Rich Trott <rtrott@gmail.com> | 2017-01-11 23:20:54 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-01-14 20:57:26 -0800 |
commit | 97f001ab167875c8e8e8418fa55ff14ef76a4064 (patch) | |
tree | b4837d95bae42d3b9c3155204de344dc389c5965 /test/parallel/test-net-server-connections.js | |
parent | 66f09be74399b61a433a58dfe48c6fd5b9d66594 (diff) | |
download | node-new-97f001ab167875c8e8e8418fa55ff14ef76a4064.tar.gz |
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>
Diffstat (limited to 'test/parallel/test-net-server-connections.js')
-rw-r--r-- | test/parallel/test-net-server-connections.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/parallel/test-net-server-connections.js b/test/parallel/test-net-server-connections.js index 7ee1df1a54..01e535803a 100644 --- a/test/parallel/test-net-server-connections.js +++ b/test/parallel/test-net-server-connections.js @@ -1,12 +1,18 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const net = require('net'); -// test that server.connections property is no longer enumerable now that it -// has been marked as deprecated - 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); |