Skip to content

Commit ccf496c

Browse files
aduh95targos
authored andcommitted
test: improve error output of test-http2-client-promisify-connect-error
PR-URL: #57135 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 8421021 commit ccf496c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/parallel/test-http2-client-promisify-connect-error.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ const server = http2.createServer();
1212

1313
server.listen(0, common.mustCall(() => {
1414
const port = server.address().port;
15-
server.close(() => {
15+
server.close(common.mustCall(() => {
1616
const connect = util.promisify(http2.connect);
17-
connect(`http://localhost:${port}`)
18-
.then(common.mustNotCall('Promise should not be resolved'))
19-
.catch(common.mustCall((err) => {
20-
assert(err instanceof Error);
21-
assert.strictEqual(err.code, 'ECONNREFUSED');
22-
}));
23-
});
17+
assert.rejects(connect(`http://localhost:${port}`), {
18+
code: 'ECONNREFUSED'
19+
}).then(common.mustCall());
20+
}));
2421
}));

0 commit comments

Comments
 (0)