Skip to content

Commit

Permalink
test: fix dns/promise import & hints type error
Browse files Browse the repository at this point in the history
  • Loading branch information
kuriyosh committed Dec 11, 2021
1 parent 1a19763 commit a197004
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/parallel/test-dns-lookup-promises-options-deprecated.js
@@ -1,15 +1,15 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const cares = internalBinding('cares_wrap');
cares.getaddrinfo = () => internalBinding('uv').UV_ENOMEM;

// This test ensures that dns.lookup issue a DeprecationWarning
// when invalid options type is given

const dns = require('dns');
const dnsPromises = dns.promises;
const dnsPromises = require('dns/promises')

common.expectWarning({
'internal/test/binding': [
Expand All @@ -20,7 +20,12 @@ common.expectWarning({
}
});

dnsPromises.lookup('127.0.0.1', { hints: '1024' });
assert.throws(() => {
dnsPromises.lookup('127.0.0.1', { hints: '-1' });
}, {
code: 'ERR_INVALID_ARG_VALUE',
name: 'TypeError'
});
dnsPromises.lookup('127.0.0.1', { family: '6' });
dnsPromises.lookup('127.0.0.1', { all: 'true' });
dnsPromises.lookup('127.0.0.1', { verbatim: 'true' });
Expand Down

0 comments on commit a197004

Please sign in to comment.