diff --git a/test/internet/test-dns-idna2008.js b/test/internet/test-dns-idna2008.js index 5a6a48b6fac39e..88c156303a06a0 100644 --- a/test/internet/test-dns-idna2008.js +++ b/test/internet/test-dns-idna2008.js @@ -16,31 +16,37 @@ const { addresses } = require('../common/internet'); const fixture = { hostname: 'straße.de', expectedAddress: '81.169.145.78', - dnsServer: addresses.DNS4_SERVER + dnsServer: addresses.DNS4_SERVER, + family: 4, }; -// Explicitly use well behaved DNS servers that are known to be able to resolve +// Explicitly use well-behaved DNS servers that are known to be able to resolve // the query (which is a.k.a xn--strae-oqa.de). dns.setServers([fixture.dnsServer]); -dns.lookup(fixture.hostname, mustCall((err, address) => { - if (err && err.errno === 'ESERVFAIL') { - assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); - return; - } - assert.ifError(err); - assert.strictEqual(address, fixture.expectedAddress); -})); +dns.lookup( + fixture.hostname, + { family: fixture.family }, + mustCall((err, address) => { + if (err && err.errno === 'ESERVFAIL') { + assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); + return; + } + assert.ifError(err); + assert.strictEqual(address, fixture.expectedAddress); + }) +); -dns.promises.lookup(fixture.hostname).then(({ address }) => { - assert.strictEqual(address, fixture.expectedAddress); -}, (err) => { - if (err && err.errno === 'ESERVFAIL') { - assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); - } else { - throw err; - } -}).finally(mustCall()); +dns.promises.lookup(fixture.hostname, { family: fixture.family }) + .then(({ address }) => { + assert.strictEqual(address, fixture.expectedAddress); + }, (err) => { + if (err && err.errno === 'ESERVFAIL') { + assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); + } else { + throw err; + } + }).finally(mustCall()); dns.resolve4(fixture.hostname, mustCall((err, addresses) => { if (err && err.errno === 'ESERVFAIL') {