Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readline: improve code coverage for readline promises #41817

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
readline: improve code coverage for readline promises
ErickWendel committed Feb 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 219a4cca2e37794e00b81660e3400bd37ce28be7
20 changes: 20 additions & 0 deletions test/parallel/test-readline-promises-interface.js
Original file line number Diff line number Diff line change
@@ -797,6 +797,26 @@ 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 });
const expectedCallTimes = 1;
signal.removeEventListener = common.mustCall(
(event, onAbortFn) => {
assert.strictEqual(event, 'abort');
assert.strictEqual(onAbortFn.name, 'onAbort');
},
expectedCallTimes);

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

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

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