Skip to content

Commit

Permalink
test: add common.mustCall test-dgram-listen-after-bind
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
zhoujiamin authored and targos committed Apr 29, 2019
1 parent 23fb430 commit c4d67f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/parallel/test-dgram-listen-after-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');

Expand All @@ -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');
});
}));

0 comments on commit c4d67f2

Please sign in to comment.