1234567891011121314151617181920212223242526272829303132333435363738 |
- "use strict";
- var RedisClient = require('../../../../src/server/repository/redis/redis.client');
- let redisClient = RedisClient.redisClient();
- let redisConn = redisClient.connection;
- var assert = require('assert');
- describe('Redis Client', function () {
- describe('When connected successfully', function () {
- it('should ok with set/get string async', function (done) {
- redisConn.setAsync('hello', 'world').then(function (res) {
- assert.strictEqual(res, 'OK');
- });
- redisConn.getAsync('hello').then(function (res) {
- assert.strictEqual(res, 'world');
- done();
- });
- });
- });
- describe('When sadd/srem with set', function () {
- it('should ok', function (done) {
- redisConn.sadd('set', 'a', 'b', 'c');
- redisConn.smembers('set', function (err, res) {
- assert.strictEqual(res.length, 3);
- redisConn.srem('set', 'a', 'b', 'c');
- done();
- });
- });
- });
- });
|