Skip to content

Commit cbcf794

Browse files
ErickWendelruyadorno
authored andcommitted
readline: improve code coverage for readline promises
PR-URL: #41817 Refs: https://coverage.nodejs.org/coverage-7123a00b03a90862/lib/readline/promises.js.html#L42 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Zijian Liu <[email protected]>
1 parent 451f333 commit cbcf794

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/parallel/test-readline-promises-interface.js

+18
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,24 @@ for (let i = 0; i < 12; i++) {
797797
fi.emit('data', 'asdf\n');
798798
}
799799

800+
// Ensure that options.signal.removeEventListener was called
801+
{
802+
const ac = new AbortController();
803+
const signal = ac.signal;
804+
const [rli] = getInterface({ terminal });
805+
signal.removeEventListener = common.mustCall(
806+
(event, onAbortFn) => {
807+
assert.strictEqual(event, 'abort');
808+
assert.strictEqual(onAbortFn.name, 'onAbort');
809+
});
810+
811+
rli.question('hello?', { signal }).then(common.mustCall());
812+
813+
rli.write('bar\n');
814+
ac.abort();
815+
rli.close();
816+
}
817+
800818
// Sending a blank line
801819
{
802820
const [rli, fi] = getInterface({ terminal });

0 commit comments

Comments
 (0)