Skip to content

Commit

Permalink
readline: improve code coverage for readline promises
Browse files Browse the repository at this point in the history
PR-URL: #41817
Refs: https://coverage.nodejs.org/coverage-7123a00b03a90862/lib/readline/promises.js.html#L42
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
  • Loading branch information
ErickWendel authored and ruyadorno committed Feb 8, 2022
1 parent 451f333 commit cbcf794
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/parallel/test-readline-promises-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,24 @@ for (let i = 0; i < 12; i++) {
fi.emit('data', 'asdf\n');
}

// Ensure that options.signal.removeEventListener was called
{
const ac = new AbortController();
const signal = ac.signal;
const [rli] = getInterface({ terminal });
signal.removeEventListener = common.mustCall(
(event, onAbortFn) => {
assert.strictEqual(event, 'abort');
assert.strictEqual(onAbortFn.name, 'onAbort');
});

rli.question('hello?', { signal }).then(common.mustCall());

rli.write('bar\n');
ac.abort();
rli.close();
}

// Sending a blank line
{
const [rli, fi] = getInterface({ terminal });
Expand Down

0 comments on commit cbcf794

Please sign in to comment.