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
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