https://github.com/lttb/redis-mock
https://github.com/lttb/redis-mock
ioredis mock redis testing
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lttb/redis-mock
- Owner: lttb
- Created: 2016-04-22T11:25:05.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2017-06-30T12:36:44.000Z (over 8 years ago)
- Last Synced: 2025-01-02T09:46:00.541Z (9 months ago)
- Topics: ioredis, mock, redis, testing
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.