nodejs-mozilla/test/pseudo-tty/test-tty-stream-constructor...

22 lines
511 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const { ReadStream, WriteStream } = require('tty');
{
// Verify that tty.ReadStream can be constructed without new.
const stream = ReadStream(0);
stream.unref();
assert(stream instanceof ReadStream);
assert.strictEqual(stream.isTTY, true);
}
{
// Verify that tty.WriteStream can be constructed without new.
const stream = WriteStream(1);
assert(stream instanceof WriteStream);
assert.strictEqual(stream.isTTY, true);
}