yeahoffline / redis-mock

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

Optional arguments break the callbacks and skip the unit tests #130

Closed fungiboletus closed 3 years ago

fungiboletus commented 4 years ago

Optional arguments such as [EX seconds] on the SET command or multiple fields and values on the HSET command prevent the callback to be call. Perhaps since #114

Because the unit tests are done in the callbacks, they are never called and don't fail.

See for example the following test that should fail but does nothing : https://github.com/yeahoffline/redis-mock/blob/9d1efe73d8ab5245ee69b932096079c1dc8328a7/test/redis-mock.strings.test.js#L92-L105

kamiljano commented 3 years ago

yeah... i saw a similar problem with SCAN. I'm trying to do SCAN 0 COUNT 100 without specifying the MATCH parameter. Since this bug report has been around for a while, and no one else cares, I'm just gonna go ahead and fix it. It looks like the bug is somewhere in this cool function that starts with // eslint-disable-line complexity followed by a function that is impossible to comprehend. That part is beyond any repair. It is conceptually wrong... so yeah. That's a cool area to get my hands on

kamiljano commented 3 years ago

this should do it: https://github.com/yeahoffline/redis-mock/pull/149