openport
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -6,3 +6,3 @@ { | ||
"keywords": ["port", "network", "open"], | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"engines": { "node" : ">=0.6.0" }, | ||
@@ -13,4 +13,7 @@ "maintainers": [ | ||
"devDependencies": { | ||
"nodeunit": "0.7.3" | ||
"nodeunit": "0.10.2" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/nodeunit/bin/nodeunit test" | ||
}, | ||
"bugs": { "url": "https://github.com/joeferner/node-openport/issues" }, | ||
@@ -17,0 +20,0 @@ "license": "MIT", |
@@ -232,4 +232,56 @@ 'use strict'; | ||
}); | ||
} | ||
}, | ||
'finds open port on mismatched ip V 4 to 6 (and vice versa)': function (test) { | ||
var server = net.createServer(); | ||
// start on ipV4 | ||
server.listen({ host: '0.0.0.0', port: 1024 }, function () { | ||
op.find( | ||
{ | ||
ports: [ 1024, 1025 ] | ||
}, | ||
function (err, port) { | ||
test.ok(!err); | ||
test.notEqual(1025, port, 'uh oh we looked for ipV6'); | ||
test.equals(1024, port, 'yup I\'m a bozo'); | ||
server.close(); | ||
test.done(); | ||
}); | ||
}); | ||
}, | ||
'finds open port on matched IPv4': function (test) { | ||
var server = net.createServer(); | ||
// start on ipV4 | ||
server.listen({ host: '0.0.0.0', port: 1024 }, function () { | ||
op.find( | ||
{ | ||
host: '0.0.0.0', | ||
ports: [ 1024, 1025 ] | ||
}, | ||
function (err, port) { | ||
test.ok(!err); | ||
test.equals(1025, port); | ||
server.close(); | ||
test.done(); | ||
}); | ||
}); | ||
}, | ||
'finds open port on matched IPv4 with start and ending ports': function (test) { | ||
var server = net.createServer(); | ||
// start on ipV4 | ||
server.listen({ host: '0.0.0.0', port: 1024 }, function () { | ||
op.find( | ||
{ | ||
host: '0.0.0.0', | ||
startingPort: 1024, | ||
endingPort: 1025, | ||
}, | ||
function (err, port) { | ||
test.ok(!err); | ||
test.equals(1025, port); | ||
server.close(); | ||
test.done(); | ||
}); | ||
}); | ||
}, | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
99111
10199