yeahoffline / redis-mock

Node.js redis client mock
213 stars 111 forks source link

Can't promisify `Multi` #64

Open jlr7245 opened 6 years ago

jlr7245 commented 6 years ago

The node_redis documentation recommends promisifying like so:

bluebird.promisifyAll(redis.Multi.prototype)
bluebird.promisifyAll(redis.RedisClient.prototype)

However, this does not work for redis-mock: Cannot read property Multi of undefined.

It would be ideal if this could be supported. I am planning to try and make a PR for this at some point soonish, but if anyone else has run into this issue and knows a way around it, it would be appreciated.

kretz commented 6 years ago

The following works for me.

var redis = require('redis-mock');
var bluebird = require('bluebird');
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);