Skip to content

Commit

Permalink
test: refactor test-readline-interface to be shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
juanarbol committed May 14, 2021
1 parent 0d7644f commit 051067f
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((invalidArg) => {
assert.throws(() => {
readline.createInterface({
input,
completer: invalidArg
});
}, {
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 051067f

Please sign in to comment.