We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc826ca commit 90a9917Copy full SHA for 90a9917
test/parallel/test-dgram-bind.js
@@ -1,13 +1,17 @@
1
'use strict';
2
-require('../common');
+const common = require('../common');
3
const assert = require('assert');
4
const dgram = require('dgram');
5
6
const socket = dgram.createSocket('udp4');
7
8
-socket.on('listening', function() {
+socket.on('listening', common.mustCall(() => {
9
+ assert.throws(() => {
10
+ socket.bind();
11
+ }, /^Error: Socket is already bound$/);
12
+
13
socket.close();
-});
14
+}));
15
16
const result = socket.bind(); // should not throw
17
0 commit comments