MCPcopy Index your code
hub / github.com/nodejs/node / createMockedLookup

Function createMockedLookup

test/common/dns.js:323–340  ·  view source on GitHub ↗
(...addresses)

Source from the content-addressed store, hash-verified

321}
322
323function createMockedLookup(...addresses) {
324 addresses = addresses.map((address) => ({ address: address, family: isIP(address) }));
325
326 // Create a DNS server which replies with a AAAA and a A record for the same host
327 return function lookup(hostname, options, cb) {
328 if (options.all === true) {
329 process.nextTick(() => {
330 cb(null, addresses);
331 });
332
333 return;
334 }
335
336 process.nextTick(() => {
337 cb(null, addresses[0].address, addresses[0].family);
338 });
339 };
340}
341
342module.exports = {
343 types,

Calls 3

isIPFunction · 0.85
mapMethod · 0.65
cbFunction · 0.50

Tested by

no test coverage detected