Closed cfredhart closed 3 years ago
@cfredhart thanks for the report. I don't see why ...
shouldn't be used for multis as well. This is only working now because the underlying client flattens args at runtime too (though ideally redis-mock should mirror that behaviour). Would you like to open a PR?
I can open a PR. I also have a PR open for redis-mock to flatten the args on that side.
When setting up the commands for the
WrappedNodeRedisClientImpl.prototype
, the flattened array of parameters are passed using the spread operator in src/node_redis/index.ts#58,however, the flattened array of parameters is passed without using the spread operator in src/node_redis/multi.ts#L61
The result appears to be that for multi commands, the wrapped
nodeRedis
instance receives its parameters as a single array whereas non-multi functions receive their arguments as separate arguments. This seems to cause an issue when mocking the underlying redis instance with redis-mock since it does not correctly handle the parameters received from the multi functions.