test: modernizing test-dgram-listen-after-bind with arrow functions

PR-URL: https://github.com/nodejs/node/pull/23500
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
chrisforrette 2018-10-12 10:08:45 -07:00 committed by Ruben Bridgewater
parent 5a30621d16
commit 661e7323ee
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -29,16 +29,16 @@ const socket = dgram.createSocket('udp4');
socket.bind();
let fired = false;
const timer = setTimeout(function() {
const timer = setTimeout(() => {
socket.close();
}, 100);
socket.on('listening', function() {
socket.on('listening', () => {
clearTimeout(timer);
fired = true;
socket.close();
});
socket.on('close', function() {
socket.on('close', () => {
assert(fired, 'listening should fire after bind');
});