cache-manager 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +3 -0
- package/lib/caching.js +1 -1
- package/package.json +1 -1
- package/test/caching.unit.js +18 -0
package/History.md
CHANGED
package/lib/caching.js
CHANGED
|
@@ -38,7 +38,7 @@ var caching = function(args) {
|
|
|
38
38
|
if (typeof args.isCacheableValue === 'function') {
|
|
39
39
|
self._isCacheableValue = args.isCacheableValue;
|
|
40
40
|
} else if (typeof self.store.isCacheableValue === 'function') {
|
|
41
|
-
self._isCacheableValue = self.store.isCacheableValue;
|
|
41
|
+
self._isCacheableValue = self.store.isCacheableValue.bind(self.store);
|
|
42
42
|
} else {
|
|
43
43
|
self._isCacheableValue = function(value) {
|
|
44
44
|
return value !== undefined;
|
package/package.json
CHANGED
package/test/caching.unit.js
CHANGED
|
@@ -1234,4 +1234,22 @@ describe("caching", function() {
|
|
|
1234
1234
|
});
|
|
1235
1235
|
});
|
|
1236
1236
|
});
|
|
1237
|
+
|
|
1238
|
+
describe("when using store's isCacheableValue method", function() {
|
|
1239
|
+
it("should not break its' context", function() {
|
|
1240
|
+
var store = {
|
|
1241
|
+
isCacheableValue: function() {
|
|
1242
|
+
if (this !== store) {
|
|
1243
|
+
throw new Error("Broken store context");
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
get: function() {},
|
|
1247
|
+
set: function() {},
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
cache = caching({store: store});
|
|
1251
|
+
|
|
1252
|
+
assert.doesNotThrow(cache._isCacheableValue);
|
|
1253
|
+
});
|
|
1254
|
+
});
|
|
1237
1255
|
});
|