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,
});
const assertAbort = async (socket, testName) => {
try {
await once(socket, 'close');
assert.fail(`close ${testName} should have thrown`);
} catch (err) {
assert.strictEqual(err.name, 'AbortError');
}
};
function assertAbort(socket, testName) {
return assert.rejects(() => once(socket, 'close'), {
name: 'AbortError',
}, `close ${testName} should have thrown`);
}
async function postAbort() {
const ac = new AbortController();