test: add common.mustCall test-dgram-listen-after-bind
PR-URL: https://github.com/nodejs/node/pull/27454 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
77b9007395
commit
eecf100049
@ -21,6 +21,7 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
||||
@ -33,12 +34,12 @@ const timer = setTimeout(() => {
|
||||
socket.close();
|
||||
}, 100);
|
||||
|
||||
socket.on('listening', () => {
|
||||
socket.on('listening', common.mustCall(() => {
|
||||
clearTimeout(timer);
|
||||
fired = true;
|
||||
socket.close();
|
||||
});
|
||||
}));
|
||||
|
||||
socket.on('close', () => {
|
||||
socket.on('close', common.mustCall(() => {
|
||||
assert(fired, 'listening should fire after bind');
|
||||
});
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user