test: improve error output of test-http2-client-promisify-connect-error

PR-URL: https://github.com/nodejs/node/pull/57135
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Antoine du Hamel authored and RafaelGSS committed 2025-04-17 10:51:03 -03:00
1 parent d1845edd21
commit 89f3feb364
1 file changed
+5 -8
@@ -12,13 +12,10 @@ const server = http2.createServer();
server.listen(0, common.mustCall(() => {
const port = server.address().port;
server.close(() => {
server.close(common.mustCall(() => {
const connect = util.promisify(http2.connect);
connect(`http://localhost:${port}`)
.then(common.mustNotCall('Promise should not be resolved'))
.catch(common.mustCall((err) => {
assert(err instanceof Error);
assert.strictEqual(err.code, 'ECONNREFUSED');
}));
});
assert.rejects(connect(`http://localhost:${port}`), {
code: 'ECONNREFUSED'
}).then(common.mustCall());
}));
}));