mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2024-11-17 04:53:06 +00:00
21 lines
879 B
JavaScript
21 lines
879 B
JavaScript
|
var vows = require('vows');
|
||
|
var assert = require('assert');
|
||
|
var RateLimiter = require('../lib/rateLimiter');
|
||
|
|
||
|
vows.describe('RateLimiter').addBatch({
|
||
|
'interval validation': {
|
||
|
'invalid interval': function() {
|
||
|
assert.throws(function() { new RateLimiter(1, 'junk'); }, /interval/);
|
||
|
},
|
||
|
'valid intervals': function() {
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'sec'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'second'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'min'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'minute'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'hr'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'hour'); });
|
||
|
assert.doesNotThrow(function() { new RateLimiter(1, 'day'); });
|
||
|
}
|
||
|
}
|
||
|
}).export(module);
|