diff --git a/test/parallel/test-dgram-bind.js b/test/parallel/test-dgram-bind.js index 882f2e87bd..f4624358a4 100644 --- a/test/parallel/test-dgram-bind.js +++ b/test/parallel/test-dgram-bind.js @@ -1,13 +1,17 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); -socket.on('listening', function() { +socket.on('listening', common.mustCall(() => { + assert.throws(() => { + socket.bind(); + }, /^Error: Socket is already bound$/); + socket.close(); -}); +})); const result = socket.bind(); // should not throw