mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
deb713e24b
`HandleWrap.isRefed()` was renamed to `hasRef()`. However, the filename of related TCs has not been reflected. Refs: https://github.com/nodejs/node/commit/f31a5ec34a PR-URL: https://github.com/nodejs/node/pull/42754 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
24 lines
864 B
JavaScript
24 lines
864 B
JavaScript
// Flags: --expose-internals --no-warnings
|
|
'use strict';
|
|
|
|
// See also test/parallel/test-handle-wrap-hasref.js
|
|
|
|
const common = require('../common');
|
|
const strictEqual = require('assert').strictEqual;
|
|
const ReadStream = require('tty').ReadStream;
|
|
const tty = new ReadStream(0);
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const isTTY = internalBinding('tty_wrap').isTTY;
|
|
strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY');
|
|
strictEqual(tty._handle.hasRef(),
|
|
true, 'tty_wrap: not initially refed');
|
|
tty.unref();
|
|
strictEqual(tty._handle.hasRef(),
|
|
false, 'tty_wrap: unref() ineffective');
|
|
tty.ref();
|
|
strictEqual(tty._handle.hasRef(),
|
|
true, 'tty_wrap: ref() ineffective');
|
|
tty._handle.close(common.mustCall(() =>
|
|
strictEqual(tty._handle.hasRef(),
|
|
false, 'tty_wrap: not unrefed on close')));
|