Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions test/parallel/test-readline-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const common = require('../common');
const PassThrough = require('stream').PassThrough;
const assert = require('assert');
const inherits = require('util').inherits;
const extend = require('util')._extend;
const Interface = require('readline').Interface;


Expand All @@ -12,6 +11,10 @@ function FakeInput() {
}
inherits(FakeInput, PassThrough);

function extend(k) {
return Object.assign({ ctrl: false, meta: false, shift: false }, k);
}


const fi = new FakeInput();
const fo = new FakeInput();
Expand All @@ -32,9 +35,7 @@ function addTest(sequences, expectedKeys) {
expectedKeys = [ expectedKeys ];
}

expectedKeys = expectedKeys.map(function(k) {
return k ? extend({ ctrl: false, meta: false, shift: false }, k) : k;
});
expectedKeys = expectedKeys.map(extend);

keys = [];

Expand Down Expand Up @@ -65,9 +66,7 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
expectedKeys = [ expectedKeys ];
}

expectedKeys = expectedKeys.map(function(k) {
return k ? extend({ ctrl: false, meta: false, shift: false }, k) : k;
});
expectedKeys = expectedKeys.map(extend);

const keys = [];
fi.on('keypress', (s, k) => keys.push(k));
Expand Down