An open API service indexing awesome lists of open source software.

https://github.com/lttb/redis-mock


https://github.com/lttb/redis-mock

ioredis mock redis testing

Last synced: 8 months ago
JSON representation

Awesome Lists containing this project

README

          

# redis-mock

This mock was implemented for testing business-logic using Redis features.
API was based on [ioredis](https://github.com/luin/ioredis) API with Promises.

### Current features:
* Pub/Sub
* Lists: [lr]push / b?[rl]pop
* Strings: get, set
* Keys: del, exists, expire, pttl, ttl
* Sets: sadd, srem, sismember
* onevent listeners

#### Why?

Of course, your services must be isolated from the IO, almost always has to be an abstract wrapper. And, of course, to evaluate your system you need real Redis.
But this mock allows you to easily test the application without worrying about deploying Redis, about Redis current state and storage, and it's easy to implement various breakpoints in the internal API, etc. You can fearlessly completely clean RedisMockStore for each test or share RedisMockStore for a few specific tests, forming a simple integration test for example.