aboutsummaryrefslogtreecommitdiff
path: root/test/simple/test-c-ares.js
blob: e84c240de6829f736b958afeecb41299056d54e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require('../common');

var dns = require("dns");


// Try resolution without callback

dns.getHostByName('localhost', function (error, result) {
   p(result);
   assert.deepEqual(['127.0.0.1'], result);
});

dns.getHostByName('127.0.0.1', function (error, result) {
   p(result);
   assert.deepEqual(['127.0.0.1'], result);
});

dns.lookup(null, function (error, result, addressType) {
   assert.equal(null, result);
   assert.equal(4, addressType);
});

dns.lookup('127.0.0.1', function (error, result, addressType) {
   assert.equal('127.0.0.1', result);
   assert.equal(4, addressType);
});

dns.lookup('::1', function (error, result, addressType) {
   assert.equal('::1', result);
   assert.equal(6, addressType);
});

dns.lookup('ipv6.google.com', function (error, result, addressType) {
   if (error) throw error;
   p(arguments);
   //assert.equal('string', typeof result);
   assert.equal(6, addressType);
});