Skip to content
Merged
Changes from 1 commit
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
Next Next commit
test: improve test coverage of dns/promises
  • Loading branch information
kuriyosh committed Dec 11, 2021
commit 1a197638a400d344d2b45443fc9e0892e7464cf1
27 changes: 27 additions & 0 deletions test/parallel/test-dns-lookup-promises-options-deprecated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');
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;
Comment thread
kuriyosh marked this conversation as resolved.
Outdated

common.expectWarning({
'internal/test/binding': [
'These APIs are for internal testing only. Do not use them.',
],
'DeprecationWarning': {
DEP0153: 'Type coercion of dns.lookup options is deprecated'
}
});

dnsPromises.lookup('127.0.0.1', { hints: '1024' });
dnsPromises.lookup('127.0.0.1', { family: '6' });
dnsPromises.lookup('127.0.0.1', { all: 'true' });
dnsPromises.lookup('127.0.0.1', { verbatim: 'true' });
dnsPromises.lookup('127.0.0.1', '6');