This commit completes code coverage for dgram's Socket#ref() and Socket#unref() methods. PR-URL: https://github.com/nodejs/node/pull/11240 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
410 B
JavaScript
19 lines
410 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const dgram = require('dgram');
|
|
|
|
{
|
|
// Test the case of unref()'ing a socket with a handle.
|
|
const s = dgram.createSocket('udp4');
|
|
s.bind();
|
|
s.unref();
|
|
}
|
|
|
|
{
|
|
// Test the case of unref()'ing a socket with no handle.
|
|
const s = dgram.createSocket('udp4');
|
|
|
|
s.close(common.mustCall(() => s.unref()));
|
|
}
|
|
|
|
setTimeout(common.mustNotCall(), 1000).unref();
|