0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-diagnostics-channel-udp.js
theanarkh 60898eed65
lib: add diagnostics channel and perf hooks detail
PR-URL: https://github.com/nodejs/node/pull/43984
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-07-29 14:27:16 +01:00

16 lines
452 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');
const dc = require('diagnostics_channel');
const udpSocketChannel = dc.channel('udp.socket');
const isUDPSocket = (socket) => socket instanceof dgram.Socket;
udpSocketChannel.subscribe(common.mustCall(({ socket }) => {
assert.strictEqual(isUDPSocket(socket), true);
}));
const socket = dgram.createSocket('udp4');
socket.close();