dynamodb-recs
Advanced tools
Comparing version 1.0.37 to 1.0.38
@@ -138,3 +138,3 @@ const _ = require('lodash'); | ||
rxop.mergeMap(response => { | ||
if (_.size(response)) { | ||
if (cache && _.size(response)) { | ||
return this.cache.insertOrReplace({ | ||
@@ -141,0 +141,0 @@ ...cacheKeys, |
@@ -203,2 +203,3 @@ const _ = require('lodash'); | ||
beforeEach(() => { | ||
sinon.spy(app.models.recs.cache, 'insertOrReplace'); | ||
sinon.spy(app.models.recs.graph, 'traverse'); | ||
@@ -208,2 +209,3 @@ }); | ||
afterEach(() => { | ||
app.models.recs.cache.insertOrReplace.restore(); | ||
app.models.recs.graph.traverse.restore(); | ||
@@ -245,2 +247,8 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledOnceWithExactly({ | ||
id: sinon.match.string, | ||
namespace, | ||
value: sinon.match.array, | ||
ttl: sinon.match.number | ||
}); | ||
}, null, done); | ||
@@ -266,2 +274,8 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledOnceWithExactly({ | ||
id: sinon.match.string, | ||
namespace, | ||
value: sinon.match.array, | ||
ttl: sinon.match.number | ||
}); | ||
}, null, done); | ||
@@ -285,2 +299,10 @@ }); | ||
]); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledOnceWithExactly({ | ||
id: sinon.match.string, | ||
namespace, | ||
value: sinon.match.array, | ||
ttl: sinon.match.number | ||
}); | ||
}, null, done); | ||
@@ -304,2 +326,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -328,2 +351,8 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledOnceWithExactly({ | ||
id: sinon.match.string, | ||
namespace, | ||
value: sinon.match.array, | ||
ttl: sinon.match.number | ||
}); | ||
}, null, done); | ||
@@ -349,2 +378,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.not.have.been.called; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -371,2 +401,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledOnce; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -402,2 +433,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledTwice; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -427,2 +459,9 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledTwice; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledTwice; | ||
expect(app.models.recs.cache.insertOrReplace).to.have.been.calledWithExactly({ | ||
id: sinon.match.string, | ||
namespace, | ||
value: sinon.match.array, | ||
ttl: sinon.match.number | ||
}); | ||
}, null, done); | ||
@@ -451,2 +490,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.not.have.been.called; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -477,2 +517,3 @@ }); | ||
expect(app.models.recs.graph.traverse).to.have.been.calledTwice; | ||
expect(app.models.recs.cache.insertOrReplace).to.not.have.been.called; | ||
}, null, done); | ||
@@ -479,0 +520,0 @@ }); |
{ | ||
"name": "dynamodb-recs", | ||
"version": "1.0.37", | ||
"version": "1.0.38", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
89490
2470