toobusy-js
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/STRML/node-toobusy", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"dependencies": {}, | ||
@@ -8,0 +8,0 @@ "devDependencies": { |
10
tests.js
@@ -15,2 +15,5 @@ 'use strict'; | ||
}); | ||
it('should start automatically', function() { | ||
(toobusy.started()).should.equal(true); | ||
}); | ||
}); | ||
@@ -22,4 +25,7 @@ | ||
}); | ||
it('should throw an exception for non-numbers', function() { | ||
(function() { toobusy.maxLag('derp'); }).should.throw(/must be a number/); | ||
}); | ||
it('should throw an exception for values < 10', function() { | ||
(function() { toobusy.maxLag(9); }).should.throw; | ||
(function() { toobusy.maxLag(9); }).should.throw(/should be greater than 10/); | ||
}); | ||
@@ -38,3 +44,3 @@ it('should be configurable', function() { | ||
it('should throw an exception for values < 16', function() { | ||
(function() { toobusy.interval(15); }).should.throw; | ||
(function() { toobusy.interval(15); }).should.throw(/Interval/); | ||
}); | ||
@@ -41,0 +47,0 @@ it('should be configurable', function() { |
@@ -49,3 +49,3 @@ 'use strict'; | ||
newInterval = Math.round(newInterval); | ||
if(newInterval < 16) throw new Error("Maximum lag should be greater than 16ms."); | ||
if(newInterval < 16) throw new Error("Interval should be greater than 16ms."); | ||
@@ -81,3 +81,3 @@ toobusy.shutdown(); | ||
// If an arg was passed, try to set highWater. | ||
if (typeof interval !== "number") throw new Error("MaxLag must be a number."); | ||
if (typeof newLag !== "number") throw new Error("MaxLag must be a number."); | ||
newLag = Math.round(newLag); | ||
@@ -101,2 +101,6 @@ if(newLag < 10) throw new Error("Maximum lag should be greater than 10ms."); | ||
toobusy.started = function() { | ||
return !!checkInterval; | ||
}; | ||
/** | ||
@@ -103,0 +107,0 @@ * Private - starts checking lag. |
15479
325