summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-server-connections.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-01-11 23:20:54 -0800
committerRich Trott <rtrott@gmail.com>2017-01-14 20:57:26 -0800
commit97f001ab167875c8e8e8418fa55ff14ef76a4064 (patch)
treeb4837d95bae42d3b9c3155204de344dc389c5965 /test/parallel/test-net-server-connections.js
parent66f09be74399b61a433a58dfe48c6fd5b9d66594 (diff)
downloadandroid-node-v8-97f001ab167875c8e8e8418fa55ff14ef76a4064.tar.gz
android-node-v8-97f001ab167875c8e8e8418fa55ff14ef76a4064.tar.bz2
android-node-v8-97f001ab167875c8e8e8418fa55ff14ef76a4064.zip
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.js14
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);