diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 3413bcffd8abe9..244d2356d9e902 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +const { addresses } = require('../common/internet'); const assert = require('assert'); const cares = process.binding('cares_wrap'); const dns = require('dns'); @@ -92,6 +93,30 @@ common.expectsError(() => { all: false }); assert.deepStrictEqual(res, { address: '127.0.0.1', family: 4 }); + + assert.rejects( + dnsPromises.lookup(addresses.INVALID_HOST, { + hints: 0, + family: 0, + all: false + }), + { + code: 'ENOTFOUND', + message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}` + } + ); + + assert.rejects( + dnsPromises.lookup(addresses.INVALID_HOST, { + hints: 0, + family: 0, + all: true + }), + { + code: 'ENOTFOUND', + message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}` + } + ); })(); dns.lookup(false, {