redis-assert
Easy assertions for Redis
Features
- Assert the state of your Redis database in your tests
- Makes performing multiple assertions easy (no need to inspect the results of
redis.multi()
) - Assertion interface matches the node-redis library
Installation
npm i --save-dev redis-assert
Usage
'use strict'; const assert = ;const redisAssert = ;const redis = ; const db = { redis; }; ;
API
redisAssert(redis)
Returns an assertion object that includes all of the same functions as the node-redis library's multi
command.
Parameters
redis
- An instance of node-redis
.assert(cb)
Executes a transcation query to Redis (using multi
) and asserts that the results returned match the values provided.
Parameters
cb
- A function called with an optional error object when an assertion fails.