You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
This is not necessary as the command itself is only used from inside the code and as they are (now) all lower case it is safe to remove the toLowerCase
55 lines
2.0 KiB
JavaScript
55 lines
2.0 KiB
JavaScript
'use strict';
|
|
|
|
var assert = require("assert");
|
|
var config = require("../lib/config");
|
|
var helper = require("../helper");
|
|
var redis = config.redis;
|
|
|
|
describe("The 'client' method", function () {
|
|
|
|
helper.allTests(function(parser, ip, args) {
|
|
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();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|