Skip to content

Commit 99b2369

Browse files
anonrigaduh95
authored andcommitted
test: simplify test-tls-connect-abort-controller.js
PR-URL: #57338 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2fbd3bb commit 99b2369

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/parallel/test-tls-connect-abort-controller.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ server.listen(0, common.mustCall(async () => {
2323
rejectUnauthorized: false,
2424
});
2525

26-
const assertAbort = async (socket, testName) => {
27-
try {
28-
await once(socket, 'close');
29-
assert.fail(`close ${testName} should have thrown`);
30-
} catch (err) {
31-
assert.strictEqual(err.name, 'AbortError');
32-
}
33-
};
26+
function assertAbort(socket, testName) {
27+
return assert.rejects(() => once(socket, 'close'), {
28+
name: 'AbortError',
29+
}, `close ${testName} should have thrown`);
30+
}
3431

3532
async function postAbort() {
3633
const ac = new AbortController();

0 commit comments

Comments
 (0)