mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
readline: improve code coverage for readline promises
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
38007df999
commit
92b85e7cf4
1 file changed
+18
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user