mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
test: add coverage for string array dgram send()
This commit adds code coverage for dgram's Socket#send() where the data is an array of strings. PR-URL: https://github.com/nodejs/node/pull/11247 Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
f5ee9921e6
commit
df14956ca0
13
test/parallel/test-dgram-send-multi-string-array.js
Normal file
13
test/parallel/test-dgram-send-multi-string-array.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
const socket = dgram.createSocket('udp4');
|
||||
const data = ['foo', 'bar', 'baz'];
|
||||
|
||||
socket.on('message', common.mustCall((msg, rinfo) => {
|
||||
socket.close();
|
||||
assert.deepStrictEqual(msg.toString(), data.join(''));
|
||||
}));
|
||||
|
||||
socket.bind(() => socket.send(data, socket.address().port, 'localhost'));
|
Loading…
Reference in New Issue
Block a user