Skip to content

Commit 91fb0cb

Browse files
TrottMylesBorins
authored andcommitted
test: refactor test-dgram-oob-buffer
* Change common.noop to common.mustNotCall() to verify callback is not invoked. * Add destructuring assignment for clarity. Yeah, clarity. That's why. PR-URL: #13443 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 08f7cca commit 91fb0cb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/parallel/test-dgram-oob-buffer.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ const socket = dgram.createSocket('udp4');
1010
const buf = Buffer.from([1, 2, 3, 4]);
1111
const portGetter = dgram.createSocket('udp4')
1212
.bind(0, 'localhost', common.mustCall(() => {
13-
const address = portGetter.address();
13+
const { address, port } = portGetter.address();
1414
portGetter.close(common.mustCall(() => {
15-
function ok() {}
16-
socket.send(buf, 0, 0, address.port, address.address, ok);
17-
socket.send(buf, 0, 4, address.port, address.address, ok);
18-
socket.send(buf, 1, 3, address.port, address.address, ok);
19-
socket.send(buf, 3, 1, address.port, address.address, ok);
15+
socket.send(buf, 0, 0, port, address, common.mustNotCall());
16+
socket.send(buf, 0, 4, port, address, common.mustNotCall());
17+
socket.send(buf, 1, 3, port, address, common.mustNotCall());
18+
socket.send(buf, 3, 1, port, address, common.mustNotCall());
2019
// Since length of zero means nothing, don't error despite OOB.
21-
socket.send(buf, 4, 0, address.port, address.address, ok);
20+
socket.send(buf, 4, 0, port, address, common.mustNotCall());
2221

2322
socket.close();
2423
}));

0 commit comments

Comments
 (0)