mirror of https://github.com/nodejs/node.git
test: refactor net-connect-handle-econnrefused
- Remove unneeded server - Use `common.PORT` PR-URL: https://github.com/nodejs/node/pull/27014 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>pull/27442/head
parent
f7afed17b6
commit
66cf4b5d6e
|
@ -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');
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue