You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
slight refactor from code review
smoke test large list of commands ported more tests to mocha, some slight cleanup in tests move sinon and uuid to dev dependencies finished porting eval tests over to mocha rebased mocha testing branch with master ported client and script tests ported watch tests ported detect_buffers tests ported unref tests ported auth tests over to mocha ported idle and no_delay tests ported hlen, hset continuing marching forward ported hincrby, sinter, sort, pubsub tests. improved logic in redis-process, I was still occasionally having issues where redis failed to exit. switch back to default test command ported del, exists, hlen, keys, randomkey, type cleanup based on what I've learned so far from refactor. we now start and stop redis less often. moved tests to their final resting place finished porting node_redis client tests ported hgetall, mget, msetnx, rename, renamenx, setex, setnx ported hgetall, mget, msetnx, rename, renamenx, setex, setnx ported queue tests to mocha amalgamated some of the helper logic ported sadd, scard, sismember, srem, utf-8
This commit is contained in:
61
test/commands/client.spec.js
Normal file
61
test/commands/client.spec.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var assert = require("assert");
|
||||
var config = require("../lib/config");
|
||||
var helper = require("../helper");
|
||||
var redis = config.redis;
|
||||
|
||||
describe("The 'client' method", function () {
|
||||
|
||||
function allTests(parser, ip) {
|
||||
var args = config.configureClient(parser, ip);
|
||||
var pattern = /addr=/;
|
||||
|
||||
describe("using " + parser + " and " + ip, function () {
|
||||
var client;
|
||||
|
||||
beforeEach(function (done) {
|
||||
client = redis.createClient.apply(redis.createClient, args);
|
||||
client.once("error", done);
|
||||
client.once("connect", function () {
|
||||
client.flushdb(function (err) {
|
||||
if (!helper.serverVersionAtLeast(client, [2, 4, 0])) {
|
||||
err = Error('script not supported in redis <= 2.4.0')
|
||||
}
|
||||
return done(err);
|
||||
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
});
|
||||
|
||||
describe('list', function () {
|
||||
it('lists connected clients', function (done) {
|
||||
client.client("list", helper.match(pattern, done));
|
||||
});
|
||||
|
||||
it("lists connected clients when invoked with multi's chaining syntax", function (done) {
|
||||
client.multi().client("list").exec(function(err, results) {
|
||||
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
||||
return done()
|
||||
})
|
||||
});
|
||||
|
||||
it("lists connected clients when invoked with multi's array syntax", function (done) {
|
||||
client.multi().client("list").exec(function(err, results) {
|
||||
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
||||
return done()
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
['javascript', 'hiredis'].forEach(function (parser) {
|
||||
allTests(parser, "/tmp/redis.sock");
|
||||
['IPv4', 'IPv6'].forEach(function (ip) {
|
||||
allTests(parser, ip);
|
||||
})
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user