mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
test: use common.mustCall(), and log the events
PR-URL: https://github.com/nodejs/node/pull/25508 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
1b542e8ba0
commit
50d2c8e945
1 file changed
+9
-2
@@ -40,6 +40,7 @@ const messageUtf8 = 'x√ab c';
|
||||
const messageAscii = 'xb\b\u001aab c';
|
||||
|
||||
const server = tls.Server(options, common.mustCall(function(socket) {
|
||||
console.log('server: on secureConnection', socket.getProtocol());
|
||||
socket.end(messageUtf8);
|
||||
}));
|
||||
|
||||
@@ -55,12 +56,18 @@ server.listen(0, function() {
|
||||
client.setEncoding('ascii');
|
||||
|
||||
client.on('data', function(d) {
|
||||
console.log('client: on data', d);
|
||||
assert.ok(typeof d === 'string');
|
||||
buffer += d;
|
||||
});
|
||||
|
||||
client.on('secureConnect', common.mustCall(() => {
|
||||
console.log('client: on secureConnect');
|
||||
}));
|
||||
|
||||
client.on('close', common.mustCall(function() {
|
||||
console.log('client: on close');
|
||||
|
||||
client.on('close', function() {
|
||||
// readyState is deprecated but we want to make
|
||||
// sure this isn't triggering an assert in lib/net.js
|
||||
// See https://github.com/nodejs/node-v0.x-archive/issues/1069.
|
||||
@@ -75,5 +82,5 @@ server.listen(0, function() {
|
||||
assert.strictEqual(messageAscii, buffer);
|
||||
|
||||
server.close();
|
||||
});
|
||||
}));
|
||||
});
|
||||
Reference in new issue
Block a user