mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
df14956ca0
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>
14 lines
407 B
JavaScript
14 lines
407 B
JavaScript
'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'));
|