Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions test/parallel/test-http2-client-promisify-connect-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const assert = require('assert');
const http2 = require('http2');
const util = require('util');

const server = http2.createServer();
const connect = util.promisify(http2.connect);

server.listen(0, common.mustCall(() => {
const port = server.address().port;
server.close(common.mustCall(() => {
const connect = util.promisify(http2.connect);
assert.rejects(connect(`http://localhost:${port}`), {
code: 'ECONNREFUSED'
}).then(common.mustCall());
}));
}));
const error = new Error('Unable to resolve hostname');

function lookup(hostname, options, callback) {
callback(error);
}

assert.rejects(
connect('http://hostname', { lookup }),
error,
).then(common.mustCall());
Loading