test: simplify test-tls-connect-abort-controller.js

PR-URL: https://github.com/nodejs/node/pull/57338
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Yagiz Nizipli 2025-03-07 16:21:02 -05:00 committed by GitHub
parent abd73d865a
commit 2eea453745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,14 +23,11 @@ server.listen(0, common.mustCall(async () => {
rejectUnauthorized: false, rejectUnauthorized: false,
}); });
const assertAbort = async (socket, testName) => { function assertAbort(socket, testName) {
try { return assert.rejects(() => once(socket, 'close'), {
await once(socket, 'close'); name: 'AbortError',
assert.fail(`close ${testName} should have thrown`); }, `close ${testName} should have thrown`);
} catch (err) { }
assert.strictEqual(err.name, 'AbortError');
}
};
async function postAbort() { async function postAbort() {
const ac = new AbortController(); const ac = new AbortController();