Skip to content

Commit

Permalink
test: refactor test-readline-interface to be shorter
Browse files Browse the repository at this point in the history
PR-URL: #38691
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
juanarbol authored and targos committed May 18, 2021
1 parent 8eea317 commit ff1b432
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions test/parallel/test-readline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,16 @@ function assertCursorRowsAndCols(rli, rows, cols) {
const input = new FakeInput();

// Constructor throws if completer is not a function or undefined
assert.throws(() => {
readline.createInterface({
input,
completer: 'string is not valid'
});
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE'
});

assert.throws(() => {
readline.createInterface({
input,
completer: ''
});
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE'
});

assert.throws(() => {
readline.createInterface({
input,
completer: false
['not an array', 123, 123n, {}, true, Symbol(), null].forEach((invalid) => {
assert.throws(() => {
readline.createInterface({
input,
completer: invalid
});
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE'
});
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE'
});

// Constructor throws if history is not an array
Expand Down

0 comments on commit ff1b432

Please sign in to comment.