hmpo-cached-model
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -114,3 +114,5 @@ 'use strict'; | ||
this.stop(); | ||
if (this.options.storeInterval) { | ||
this.loadFromStore(); | ||
this.storeTimer = setInterval( | ||
@@ -121,3 +123,5 @@ this.loadFromStore.bind(this), | ||
} | ||
if (this.options.apiInterval) { | ||
this.loadFromApi(); | ||
this.apiTimer = setInterval( | ||
@@ -124,0 +128,0 @@ this.loadFromApi.bind(this), |
{ | ||
"name": "hmpo-cached-model", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Cached polling model", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -392,2 +392,4 @@ 'use strict'; | ||
sinon.stub(HmpoCachedModel.prototype, 'stop'); | ||
sinon.stub(HmpoCachedModel.prototype, 'loadFromStore'); | ||
sinon.stub(HmpoCachedModel.prototype, 'loadFromApi'); | ||
}); | ||
@@ -397,2 +399,4 @@ | ||
HmpoCachedModel.prototype.stop.restore(); | ||
HmpoCachedModel.prototype.loadFromStore.restore(); | ||
HmpoCachedModel.prototype.loadFromApi.restore(); | ||
}); | ||
@@ -409,2 +413,8 @@ | ||
it('should run the two loding functions', () => { | ||
instance.start(); | ||
HmpoCachedModel.prototype.loadFromStore.should.have.been.called; | ||
HmpoCachedModel.prototype.loadFromApi.should.have.been.called; | ||
}); | ||
it('should create two interval timers', () => { | ||
@@ -419,2 +429,3 @@ instance.start(); | ||
instance.start(); | ||
HmpoCachedModel.prototype.loadFromStore.should.not.have.been.called; | ||
expect(instance.storeTimer).to.not.be.ok; | ||
@@ -426,2 +437,3 @@ }); | ||
instance.start(); | ||
HmpoCachedModel.prototype.loadFromApi.should.not.have.been.called; | ||
expect(instance.apiTimer).to.not.be.ok; | ||
@@ -428,0 +440,0 @@ }); |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
25380
11
515
1
40