Skip to content

Commit

Permalink
test: add test for socket.end callback
Browse files Browse the repository at this point in the history
PR-URL: nodejs#24087
Refs: nodejs#23937
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Ajido authored and Trott committed Nov 28, 2018
1 parent 086482d commit 628f955
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/parallel/test-net-socket-end-callback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const common = require('../common');
const net = require('net');

const server = net.createServer((socket) => {
socket.resume();
}).unref();

server.listen(common.mustCall(() => {
const connect = (...args) => {
const socket = net.createConnection(server.address().port, () => {
socket.end(...args);
});
};

const cb = common.mustCall(() => {}, 3);

connect(cb);
connect('foo', cb);
connect('foo', 'utf8', cb);
}));

0 comments on commit 628f955

Please sign in to comment.