test: improve test coverage of readline/promises

PR-URL: https://github.com/nodejs/node/pull/40876
Refs: https://coverage.nodejs.org/coverage-0c2011c6c5d311a9/lib/readline/promises.js.html#L33
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Yoshiki Kurihara authored and Michaël Zasso committed 2021-11-26 15:36:34 +01:00
1 parent 05d652a555
commit ae12a609a5
1 file changed
+15
@@ -910,6 +910,21 @@ for (let i = 0; i < 12; i++) {
rli.close();
}
// Throw an error when question is executed with an aborted signal
{
const ac = new AbortController();
const signal = ac.signal;
ac.abort();
const [rli] = getInterface({ terminal });
assert.rejects(
rli.question('hello?', { signal }),
{
name: 'AbortError'
}
).then(common.mustCall());
rli.close();
}
// Can create a new readline Interface with a null output argument
{
const [rli, fi] = getInterface({ output: null, terminal });