mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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:
parent
abd73d865a
commit
2eea453745
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user