standard-deviation-stream
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -35,5 +35,6 @@ module.exports = function (key, redisClient) { | ||
this.oldVariance = 0; | ||
if(redisClient) { | ||
if (redisClient) | ||
redisClient.del(this.saveKey, done); | ||
} | ||
else | ||
done('No redis client was specified when creating this standard deviation stream'); | ||
}; | ||
@@ -63,9 +64,9 @@ | ||
this.restore = function (done) { | ||
if(redisClient) { | ||
if (redisClient) { | ||
var self = this; | ||
redisClient.get( | ||
this.saveKey, | ||
self.saveKey, | ||
function (err, result) { | ||
if (err) | ||
done(); | ||
done(err); | ||
else | ||
@@ -87,2 +88,6 @@ { | ||
} | ||
else | ||
{ | ||
done('No redis client was specified when creating this standard deviation stream'); | ||
} | ||
}; | ||
@@ -92,3 +97,3 @@ | ||
this.save = function (done) { | ||
if(redisClient) { | ||
if (redisClient) { | ||
var self = this; | ||
@@ -109,3 +114,7 @@ | ||
} | ||
else | ||
{ | ||
done('No redis client was specified when creating this standard deviation stream'); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "standard-deviation-stream", | ||
"description": "A basic method for calculating standard deviation on the fly from a stream of numbers.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": { | ||
@@ -15,5 +15,5 @@ "name": "Nathan Peck", | ||
"dependencies": { | ||
"redis": "0.10.0" | ||
}, | ||
"devDependencies": { | ||
"redis": "0.10.0", | ||
"mocha": "1.17.1", | ||
@@ -20,0 +20,0 @@ "chai": "1.8.1", |
@@ -129,2 +129,24 @@ var expect = require('chai').expect, | ||
describe('Attempting to use Redis operations without specifying a Redis client', function () { | ||
var nonRedisDeviation = new DeviationStream('test'); | ||
it('Attempting to save state should return an error', function () { | ||
nonRedisDeviation.save(function (err) { | ||
expect(err).to.be.a('string'); | ||
}); | ||
}); | ||
it('Attempting to restore state should return an error', function () { | ||
nonRedisDeviation.restore(function (err) { | ||
expect(err).to.be.a('string'); | ||
}); | ||
}); | ||
it('Attempting to clear state should return an error', function () { | ||
nonRedisDeviation.clear(function (err) { | ||
expect(err).to.be.a('string'); | ||
}); | ||
}); | ||
}); | ||
describe('Another sanity test', function () { | ||
@@ -131,0 +153,0 @@ before(function () { |
12489
0
245
5
- Removedredis@0.10.0
- Removedredis@0.10.0(transitive)