Skip to content

Commit c9ce98c

Browse files
andresatenciotargos
authored andcommitted
test: replace function with arrow function and remove unused argument
PR-URL: #38235 Reviewed-By: Yash Ladha <yash@yashladha.in> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent e994d6a commit c9ce98c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/parallel/test-readline-interface.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function assertCursorRowsAndCols(rli, rows, cols) {
248248
const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
249249
// ['foo', 'baz', 'bar', bat'];
250250
let callCount = 0;
251-
rli.on('line', function(line) {
251+
rli.on('line', (line) => {
252252
assert.strictEqual(line, expectedLines[callCount]);
253253
callCount++;
254254
});
@@ -324,7 +324,7 @@ function assertCursorRowsAndCols(rli, rows, cols) {
324324
});
325325
const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat'];
326326
let callCount = 0;
327-
rli.on('line', function(line) {
327+
rli.on('line', (line) => {
328328
assert.strictEqual(line, expectedLines[callCount]);
329329
callCount++;
330330
});
@@ -351,7 +351,7 @@ function assertCursorRowsAndCols(rli, rows, cols) {
351351
const [rli, fi] = getInterface({ terminal: true });
352352
const keys = [];
353353
const err = new Error('bad thing happened');
354-
fi.on('keypress', function(key) {
354+
fi.on('keypress', (key) => {
355355
keys.push(key);
356356
if (key === 'X') {
357357
throw err;
@@ -766,7 +766,7 @@ for (let i = 0; i < 12; i++) {
766766
assert.strictEqual(isWarned(process.stdout._events), false);
767767
}
768768

769-
[true, false].forEach(function(terminal) {
769+
[true, false].forEach((terminal) => {
770770
// Disable history
771771
{
772772
const [rli, fi] = getInterface({ terminal, historySize: 0 });
@@ -861,7 +861,7 @@ for (let i = 0; i < 12; i++) {
861861
const buf = Buffer.from('☮', 'utf8');
862862
const [rli, fi] = getInterface({ terminal });
863863
let callCount = 0;
864-
rli.on('line', function(line) {
864+
rli.on('line', (line) => {
865865
callCount++;
866866
assert.strictEqual(line, buf.toString('utf8'));
867867
});
@@ -905,7 +905,7 @@ for (let i = 0; i < 12; i++) {
905905
rli.setPrompt('ddd> ');
906906
rli.prompt();
907907
rli.write("really shouldn't be seeing this");
908-
rli.question('What do you think of node.js? ', function(answer) {
908+
rli.question('What do you think of node.js? ', (answer) => {
909909
console.log('Thank you for your valuable feedback:', answer);
910910
rli.close();
911911
});
@@ -957,7 +957,7 @@ for (let i = 0; i < 12; i++) {
957957
const crlfDelay = 200;
958958
const [rli, fi] = getInterface({ terminal, crlfDelay });
959959
let callCount = 0;
960-
rli.on('line', function(line) {
960+
rli.on('line', () => {
961961
callCount++;
962962
});
963963
fi.emit('data', '\r');
@@ -979,7 +979,7 @@ for (let i = 0; i < 12; i++) {
979979
const delay = 200;
980980
const [rli, fi] = getInterface({ terminal, crlfDelay });
981981
let callCount = 0;
982-
rli.on('line', function(line) {
982+
rli.on('line', () => {
983983
callCount++;
984984
});
985985
fi.emit('data', '\r');

0 commit comments

Comments
 (0)