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 <[email protected]>
Reviewed-By: Yorkie Liu <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ouyang Yadong <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
zhoujiamin authored and oyyd committed Apr 29, 2019
1 parent 77b9007 commit eecf100
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 eecf100

Please sign in to comment.