diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index a3020181b3532e..5e05610aeae8f4 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -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