summaryrefslogtreecommitdiff
path: root/test/parallel/test-tty-backwards-api.js
blob: 7b6dc3c09257bf74e2c219f7ffae18a52c30f35c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Flags: --expose-internals
'use strict';
const common = require('../common');

const noop = () => {};
const { internalBinding } = require('internal/test/binding');
const TTY = internalBinding('tty_wrap').TTY = function() {};

TTY.prototype = {
  setBlocking: noop,
  getWindowSize: noop
};

const { WriteStream } = require('tty');

const methods = [
  'cursorTo',
  'moveCursor',
  'clearLine',
  'clearScreenDown'
];

methods.forEach((method) => {
  require('readline')[method] = common.mustCall();
  const writeStream = new WriteStream(1);
  writeStream[method](1, 2);
});