summaryrefslogtreecommitdiff
path: root/test/pseudo-tty/test-tty-stream-constructors.js
blob: 27c33bad1868d649c8b1eb6cf6b31baa2050ac57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'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);
}