redistub
A Redis shell with no state, meant for testing controllers which check cache before using a model.
Install
$ npm install redistub --save
Run the specs
$ npm test
Supported Redis client API stubs
createClient
Creates a new stateless API.
var redis = redisClient = redis; // Now use redisClient as you intend to in production and write your tests to assume redis is offline.
createClient -> get
Normally used to get an item from the Redis store, this method will always
return null
for both err
and val
var redis = redisClient = redis; redisClient;
createClient -> mget
Normally used to get an array of items from the Redis store, this method will always
return null
for both err
and val
var redis = redisClient = redis; redisClient;
createClient -> set
Normally used to set an item in the Redis store, this
method will always return null
for err
and OK
for res
var redis = redisClient = redis; redisClient;
createClient -> expire
Normally used to set an expiration ttl for an item in the Redis store, this
method will always return null
for err
and 1
for affectedItems
var redis = redisClient = redis; redisClient;
createClient -> del
Normally used to remove an item from the Redis store, this
method will always return null
for err
and 1
for affectedItems
var redis = redisClient = redis; redisClient;