Skip to content

Commit

Permalink
test: refactor net-connect-handle-econnrefused
Browse files Browse the repository at this point in the history
- Remove unneeded server
- Use `common.PORT`

PR-URL: #27014
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
lpinca authored and targos committed Apr 27, 2019
1 parent e9021cc commit 50732c1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/sequential/test-net-connect-handle-econnrefused.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ const common = require('../common');
const net = require('net');
const assert = require('assert');

const server = net.createServer();
server.listen(0);
const port = server.address().port;
server.close(common.mustCall(() => {
const c = net.createConnection(port);
c.on('connect', common.mustNotCall());
c.on('error', common.mustCall((e) => {
assert.strictEqual(e.code, 'ECONNREFUSED');
}));
const c = net.createConnection(common.PORT);
c.on('connect', common.mustNotCall());
c.on('error', common.mustCall((e) => {
assert.strictEqual(e.code, 'ECONNREFUSED');
}));

0 comments on commit 50732c1

Please sign in to comment.