redis-semaphore icon indicating copy to clipboard operation
redis-semaphore copied to clipboard

Support for ioredis-mock

Open germanescobar opened this issue 1 year ago • 3 comments

Hi,

I have a case in which I need to pass an ioredis-mock instance for testing but I get the following error:

"client" must be instance of ioredis client or cluster

Is there a solution or workaround for this case?

Thanks!

germanescobar avatar Dec 31 '23 03:12 germanescobar

I had similar questions too. Is it really necessary to require a strict ioredis instance?

In my case I wanted to pass a duck-type compatible client, backed by redis-over-http client

jokester avatar Mar 13 '24 16:03 jokester

If maintainers thinks it's fine I'm happy to do something. I personally wanted a mutex that work with Upstash serverless redis.

The idea on my head is, to extract a ioredis-like interface and rely on the interface instead of instanceof check. Since only a few Redis APIs are required, I imagine the interface to be small. Other redis clients, even if they happen to name APIs differently, can be used with an adapter.

jokester avatar May 17 '24 07:05 jokester

@jokester Hi! PR is welcome

swarthy avatar May 21 '24 14:05 swarthy

Support for ioredis-mock added in v5.6.0

swarthy avatar May 26 '24 15:05 swarthy