Skip to content

Commit 9585852

Browse files
committed
Add test for passing options and callback to keys().
1 parent 712b519 commit 9585852

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/lib/redis-store-spec.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ describe('keys', function () {
383383
redisCache.set('foo', 'bar', function () {
384384
redisCache.set('far', 'boo', function () {
385385
redisCache.set('faz', 'bam', function () {
386-
redisCache.keys('f*', function (err, arrayOfKeys) {
386+
redisCache.keys('f*', { scanCount: 10 }, function (err, arrayOfKeys) {
387387
assert.equal(err, null);
388388
assert.notEqual(arrayOfKeys, null);
389389
assert.notEqual(arrayOfKeys.indexOf('foo'), -1);
@@ -411,6 +411,22 @@ describe('keys', function () {
411411
});
412412
});
413413

414+
it('should accept scanCount option without pattern', function (done) {
415+
redisCache.set('foo', 'bar', function () {
416+
redisCache.set('far', 'boo', function () {
417+
redisCache.set('faz', 'bam', function () {
418+
redisCache.keys({ scanCount: 10 }, function (err, arrayOfKeys) {
419+
assert.equal(err, null);
420+
assert.notEqual(arrayOfKeys, null);
421+
assert.notEqual(arrayOfKeys.indexOf('foo'), -1);
422+
assert.equal(arrayOfKeys.length, 3);
423+
done();
424+
});
425+
});
426+
});
427+
});
428+
});
429+
414430
it('should return an error if there is an error acquiring a connection', function (done) {
415431
var pool = redisCache.store._pool;
416432
sinon.stub(pool, 'acquireDb').yieldsAsync('Something unexpected');

0 commit comments

Comments
 (0)