Comparing version 0.2.2 to 0.2.3
@@ -0,0 +0,0 @@ var Sntp = require('../lib'); |
@@ -0,0 +0,0 @@ var Sntp = require('../lib'); |
@@ -42,2 +42,3 @@ // Load modules | ||
isFinished = true; | ||
socket.removeAllListeners(); | ||
socket.close(); | ||
@@ -52,3 +53,3 @@ return callback(err, result); | ||
socket.on('error', function (err) { | ||
socket.once('error', function (err) { | ||
@@ -55,0 +56,0 @@ return finish(err); |
{ | ||
"name": "sntp", | ||
"description": "SNTP Client", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
@@ -67,4 +67,24 @@ // Load modules | ||
it('times out on no response', function (done) { | ||
it('errors on error event', function (done) { | ||
var orig = Dgram.createSocket; | ||
Dgram.createSocket = function (type) { | ||
Dgram.createSocket = orig; | ||
var socket = Dgram.createSocket(type); | ||
process.nextTick(function () { socket.emit('error', new Error('Fake')) }); | ||
return socket; | ||
}; | ||
Sntp.time(function (err, time) { | ||
expect(err).to.exist; | ||
expect(time).to.not.exist; | ||
expect(err.message).to.equal('Fake'); | ||
done(); | ||
}); | ||
}); | ||
it('times out on invalid host', function (done) { | ||
Sntp.time({ host: 'error', timeout: 10000 }, function (err, time) { | ||
@@ -71,0 +91,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26505
557