-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set then Get fails #197
Comments
Curious about this as well. Experiencing the same behavior. |
any updates on this one? this actually prevents my from using this package |
It's because redis-mock only supports the callback syntax for redis not async/await, which was removed in the latest major version of the redis package. This works:
and as an aside, the latest version of @types/redis-mock is incorrect. |
Here's a kind of smelly workaround:
|
Building from @rbrcurtis 's workaround: I had to create a custom promisify function for the set method to be able to pass additional args, for example Because this library has a set method where the last argument is not actually the callback, but I'm sure there are better ways to do this (l couldn't get util/promisify custom to work), and this now means I can't mock ttl, but this at least got me started. I put this all in jest setup file:
|
@eatoncw The customPromisify function should have a check for args length in case if (args.length > 2)
args.pop(); |
The following code should print
bar
to the console. However, instead it printsundefined
.Running redis-mock version
0.56.3
.The text was updated successfully, but these errors were encountered: