Skip to content

Instantly share code, notes, and snippets.

@robrighter
Created January 29, 2014 15:52
Show Gist options
  • Save robrighter/8690879 to your computer and use it in GitHub Desktop.
Save robrighter/8690879 to your computer and use it in GitHub Desktop.
Redis Mock
function makeMockRedisClient(listener){
var calls = [];
return {
on: function(){
if(listener){ listener('on', arguments); }
calls.push({name: 'on', args: arguments});
},
hget: function(key, index, callback){
if(listener){ listener('hget', arguments); }
calls.push({name: 'hget', args: arguments});
callback.apply(undefined, [false, lastCheck]);
},
hset: function(key, index, value){
if(listener){ listener('hset', arguments); }
calls.push({name: 'hset', args: arguments});
},
getCallList: function(){
return calls;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment