forked from FurqanSoftware/node-whois
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.coffee
More file actions
81 lines (68 loc) · 2.73 KB
/
test.coffee
File metadata and controls
81 lines (68 loc) · 2.73 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
_ = require 'underscore'
assert = require 'assert'
whois = require './index'
describe '#lookup()', ->
it 'should work with google.com', (done) ->
whois.lookup 'google.com', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain name: google.com'), -1
done()
it 'should work with 50.116.8.109', (done) ->
whois.lookup '50.116.8.109', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('netname: linode-us'), -1
done()
it 'should honor specified WHOIS server', (done) ->
whois.lookup 'gandi.net', server: 'whois.gandi.net', (err, data) ->
assert.ifError err
data = data.toLowerCase()
assert.notEqual data.indexOf('whois server: whois.gandi.net'), -1
assert.notEqual data.indexOf('domain name: gandi.net'), -1
done()
it 'should honor specified WHOIS server with port override', (done) ->
whois.lookup 'tucows.com', server: 'whois.tucows.com:43', (err, data) ->
assert.ifError err
data = data.toLowerCase()
assert.notEqual data.indexOf('whois server: whois.tucows.com'), -1
assert.notEqual data.indexOf('domain name: tucows.com'), -1
done()
it 'should follow specified number of redirects for domain', (done) ->
whois.lookup 'google.com', follow: 1, (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain name: google.com'), -1
done()
it 'should follow specified number of redirects for IP address', (done) ->
whois.lookup '176.58.115.202', follow: 1, (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('netname: linode-uk'), -1
done()
it 'should work with nic.sh', (done) ->
whois.lookup 'nic.sh', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain reserved'), -1
done()
it 'should work with nic.io', (done) ->
whois.lookup 'nic.io', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain reserved'), -1
done()
it 'should work with nic.ac', (done) ->
whois.lookup 'nic.ac', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain reserved'), -1
done()
it 'should work with nic.tm', (done) ->
whois.lookup 'nic.tm', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain reserved'), -1
done()
it 'should work with srs.net.nz', (done) ->
whois.lookup 'srs.net.nz', (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain_name: srs.net.nz'), -1
done()
it 'should work with redundant follow', (done) ->
whois.lookup 'google.com', follow: 5, (err, data) ->
assert.ifError err
assert.notEqual data.toLowerCase().indexOf('domain name: google.com'), -1
done()