Skip to content

Commit 5776d56

Browse files
committed
Add test and up the version number
1 parent 622136c commit 5776d56

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ var redisStore = function redisStore() {
180180
redisCache.flushdb(handleResponse(cb));
181181
});
182182
},
183-
keys: function keys(pattern, cb) {
183+
keys: function keys() {
184+
var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '*';
185+
var cb = arguments[1];
184186
return new Promise(function (resolve, reject) {
185187
if (typeof pattern === 'function') {
186188
cb = pattern;

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "cache-manager-redis-store",
33
"author": "Matthijs Dabroek <[email protected]>",
44
"description": "Redis store for node-cache-manager",
5-
"version": "1.4.0",
5+
"version": "1.5.0",
66
"license": "MIT",
77
"main": "dist/index.js",
88
"repository": {
99
"type": "git",
1010
"url": "https://github.com/dabroek/node-cache-manager-redis-store.git"
1111
},
1212
"scripts": {
13-
"prepublish": "npm prune",
13+
"prepare": "npm prune",
1414
"test": "jest --forceExit",
1515
"test-cov": "jest --forceExit --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
1616
"build": "rollup -c"
@@ -25,7 +25,7 @@
2525
"babel-plugin-transform-runtime": "^6.23.0",
2626
"babel-preset-es2015": "^6.24.1",
2727
"babel-runtime": "^6.26.0",
28-
"cache-manager": "^2.7.0",
28+
"cache-manager": "^2.9.0",
2929
"coveralls": "^2.13.1",
3030
"jest": "^20.0.4",
3131
"rollup": "^0.41.6",

test/index.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,15 @@ describe('keys', () => {
569569
});
570570
});
571571

572+
it('should return an array of all keys if called without a pattern', (done) => {
573+
redisCache.mset('foo', 'bar', 'foo2', 'bar2', 'foo3', 'bar3')
574+
.then(() => redisCache.keys())
575+
.then(result => {
576+
expect(result).toHaveLength(3);
577+
done();
578+
});
579+
});
580+
572581
it('should return an array of keys without pattern', (done) => {
573582
redisCache.set('foo', 'bar', () => {
574583
redisCache.keys((err, arrayOfKeys) => {
@@ -625,6 +634,7 @@ describe('overridable isCacheableValue function', () => {
625634
beforeEach(() => {
626635
redisCache2 = cacheManager.caching({
627636
store: redisStore,
637+
auth_pass: config.auth_pass,
628638
isCacheableValue: () => {
629639
return 'I was overridden';
630640
}
@@ -643,6 +653,7 @@ describe('defaults are set by redis itself', () => {
643653
beforeEach(() => {
644654
redisCache2 = cacheManager.caching({
645655
store: redisStore,
656+
auth_pass: config.auth_pass,
646657
});
647658
});
648659

0 commit comments

Comments
 (0)