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
  • Loading branch information
zhoujiamin committed Apr 28, 2019
1 parent 8594211 commit f848701
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 f848701

Please sign in to comment.