You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Remove code overhead
Add another domain test Fix test on node 0.10
This commit is contained in:
@@ -37,7 +37,7 @@ describe("client authentication", function () {
|
|||||||
it("allows auth to be provided with 'auth' method", function (done) {
|
it("allows auth to be provided with 'auth' method", function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.auth(auth, function (err, res) {
|
client.auth(auth, function (err, res) {
|
||||||
assert.strictEqual(null, err);
|
assert.strictEqual(null, err);
|
||||||
assert.strictEqual("OK", res.toString());
|
assert.strictEqual("OK", res.toString());
|
||||||
@@ -48,7 +48,7 @@ describe("client authentication", function () {
|
|||||||
it("emits error when auth is bad without callback", function (done) {
|
it("emits error when auth is bad without callback", function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
|
|
||||||
client.once('error', function (err) {
|
client.once('error', function (err) {
|
||||||
assert.strictEqual(err.command, 'AUTH');
|
assert.strictEqual(err.command, 'AUTH');
|
||||||
@@ -62,7 +62,7 @@ describe("client authentication", function () {
|
|||||||
it("returns an error when auth is bad (empty string) with a callback", function (done) {
|
it("returns an error when auth is bad (empty string) with a callback", function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
|
|
||||||
client.auth('', function (err, res) {
|
client.auth('', function (err, res) {
|
||||||
assert.strictEqual(err.command, 'AUTH');
|
assert.strictEqual(err.command, 'AUTH');
|
||||||
@@ -114,7 +114,7 @@ describe("client authentication", function () {
|
|||||||
var args = config.configureClient(parser, ip, {
|
var args = config.configureClient(parser, ip, {
|
||||||
auth_pass: auth
|
auth_pass: auth
|
||||||
});
|
});
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@@ -127,7 +127,7 @@ describe("client authentication", function () {
|
|||||||
password: auth,
|
password: auth,
|
||||||
no_ready_check: true
|
no_ready_check: true
|
||||||
});
|
});
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -137,7 +137,7 @@ describe("client authentication", function () {
|
|||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
var args = config.configureClient(parser, ip);
|
var args = config.configureClient(parser, ip);
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.auth(auth);
|
client.auth(auth);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
return done();
|
return done();
|
||||||
@@ -148,7 +148,7 @@ describe("client authentication", function () {
|
|||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
var readyCount = 0;
|
var readyCount = 0;
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.auth(auth);
|
client.auth(auth);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
readyCount++;
|
readyCount++;
|
||||||
@@ -163,7 +163,7 @@ describe("client authentication", function () {
|
|||||||
it('should return an error if the password is not of type string and a callback has been provided', function (done) {
|
it('should return an error if the password is not of type string and a callback has been provided', function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
var async = true;
|
var async = true;
|
||||||
client.auth(undefined, function(err, res) {
|
client.auth(undefined, function(err, res) {
|
||||||
assert.strictEqual(err.message, 'ERR invalid password');
|
assert.strictEqual(err.message, 'ERR invalid password');
|
||||||
@@ -178,7 +178,7 @@ describe("client authentication", function () {
|
|||||||
it('should emit an error if the password is not of type string and no callback has been provided', function (done) {
|
it('should emit an error if the password is not of type string and no callback has been provided', function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on('error', function (err) {
|
client.on('error', function (err) {
|
||||||
assert.strictEqual(err.message, 'ERR invalid password');
|
assert.strictEqual(err.message, 'ERR invalid password');
|
||||||
assert.strictEqual(err.command, 'AUTH');
|
assert.strictEqual(err.command, 'AUTH');
|
||||||
@@ -193,7 +193,7 @@ describe("client authentication", function () {
|
|||||||
var args = config.configureClient(parser, ip, {
|
var args = config.configureClient(parser, ip, {
|
||||||
auth_pass: auth
|
auth_pass: auth
|
||||||
});
|
});
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
client.auth(auth, helper.isString('OK', done));
|
client.auth(auth, helper.isString('OK', done));
|
||||||
});
|
});
|
||||||
@@ -205,7 +205,7 @@ describe("client authentication", function () {
|
|||||||
var args = config.configureClient(parser, ip, {
|
var args = config.configureClient(parser, ip, {
|
||||||
no_ready_check: true
|
no_ready_check: true
|
||||||
});
|
});
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
client.set('foo', 'bar', function (err, res) {
|
client.set('foo', 'bar', function (err, res) {
|
||||||
assert.equal(err.message, 'NOAUTH Authentication required.');
|
assert.equal(err.message, 'NOAUTH Authentication required.');
|
||||||
@@ -218,7 +218,7 @@ describe("client authentication", function () {
|
|||||||
|
|
||||||
it('does not allow auth to be provided post-hoc with auth method if not authenticated before', function (done) {
|
it('does not allow auth to be provided post-hoc with auth method if not authenticated before', function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("error", function (err) {
|
client.on("error", function (err) {
|
||||||
assert.equal(err.code, 'NOAUTH');
|
assert.equal(err.code, 'NOAUTH');
|
||||||
assert.equal(err.message, 'Ready check failed: NOAUTH Authentication required.');
|
assert.equal(err.message, 'Ready check failed: NOAUTH Authentication required.');
|
||||||
|
@@ -22,13 +22,11 @@ describe("The 'batch' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns an empty array", function (done) {
|
it("returns an empty array", function (done) {
|
||||||
@@ -51,7 +49,7 @@ describe("The 'batch' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
|
@@ -15,14 +15,14 @@ describe("The 'blpop' method", function () {
|
|||||||
var bclient;
|
var bclient;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pops value immediately if list contains values', function (done) {
|
it('pops value immediately if list contains values', function (done) {
|
||||||
bclient = redis.createClient.apply(redis.createClient, args);
|
bclient = redis.createClient.apply(null, args);
|
||||||
redis.debug_mode = true;
|
redis.debug_mode = true;
|
||||||
var text = '';
|
var text = '';
|
||||||
var unhookIntercept = intercept(function(data) {
|
var unhookIntercept = intercept(function(data) {
|
||||||
@@ -41,7 +41,7 @@ describe("The 'blpop' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('pops value immediately if list contains values using array notation', function (done) {
|
it('pops value immediately if list contains values using array notation', function (done) {
|
||||||
bclient = redis.createClient.apply(redis.createClient, args);
|
bclient = redis.createClient.apply(null, args);
|
||||||
client.rpush(["blocking list", "initial value"], helper.isNumber(1));
|
client.rpush(["blocking list", "initial value"], helper.isNumber(1));
|
||||||
bclient.blpop(["blocking list", 0], function (err, value) {
|
bclient.blpop(["blocking list", 0], function (err, value) {
|
||||||
assert.strictEqual(value[0], "blocking list");
|
assert.strictEqual(value[0], "blocking list");
|
||||||
@@ -51,7 +51,7 @@ describe("The 'blpop' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('waits for value if list is not yet populated', function (done) {
|
it('waits for value if list is not yet populated', function (done) {
|
||||||
bclient = redis.createClient.apply(redis.createClient, args);
|
bclient = redis.createClient.apply(null, args);
|
||||||
bclient.blpop("blocking list 2", 5, function (err, value) {
|
bclient.blpop("blocking list 2", 5, function (err, value) {
|
||||||
assert.strictEqual(value[0], "blocking list 2");
|
assert.strictEqual(value[0], "blocking list 2");
|
||||||
assert.strictEqual(value[1], "initial value");
|
assert.strictEqual(value[1], "initial value");
|
||||||
@@ -61,7 +61,7 @@ describe("The 'blpop' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('times out after specified time', function (done) {
|
it('times out after specified time', function (done) {
|
||||||
bclient = redis.createClient.apply(redis.createClient, args);
|
bclient = redis.createClient.apply(null, args);
|
||||||
bclient.BLPOP("blocking list", 1, function (err, res) {
|
bclient.BLPOP("blocking list", 1, function (err, res) {
|
||||||
assert.strictEqual(res, null);
|
assert.strictEqual(res, null);
|
||||||
return done(err);
|
return done(err);
|
||||||
|
@@ -14,7 +14,7 @@ describe("The 'client' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -22,13 +22,11 @@ describe("The 'dbsize' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -43,7 +41,7 @@ describe("The 'dbsize' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(function (err, res) {
|
client.flushdb(function (err, res) {
|
||||||
helper.isString("OK")(err, res);
|
helper.isString("OK")(err, res);
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'del' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,7 @@ describe("The 'eval' method", function () {
|
|||||||
var source = "return redis.call('set', 'sha', 'test')";
|
var source = "return redis.call('set', 'sha', 'test')";
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'exists' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'expire' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -22,13 +22,11 @@ describe("The 'flushdb' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -43,7 +41,7 @@ describe("The 'flushdb' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'geoadd' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -22,13 +22,11 @@ describe("The 'get' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -49,7 +47,7 @@ describe("The 'get' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -23,13 +23,11 @@ describe("The 'getset' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -44,7 +42,7 @@ describe("The 'getset' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,7 @@ describe("The 'hgetall' method", function () {
|
|||||||
describe('regular client', function () {
|
describe('regular client', function () {
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
@@ -56,7 +56,7 @@ describe("The 'hgetall' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'hincrby' method", function () {
|
|||||||
var hash = "test hash";
|
var hash = "test hash";
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'hlen' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -14,7 +14,7 @@ describe("The 'hmget' method", function () {
|
|||||||
var hash = 'test hash';
|
var hash = 'test hash';
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb();
|
client.flushdb();
|
||||||
|
@@ -14,7 +14,7 @@ describe("The 'hmset' method", function () {
|
|||||||
var hash = 'test hash';
|
var hash = 'test hash';
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -14,7 +14,7 @@ describe("The 'hset' method", function () {
|
|||||||
var hash = 'test hash';
|
var hash = 'test hash';
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -16,16 +16,14 @@ describe("The 'incr' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.set(key, "9007199254740992", function (err, res) {
|
client.set(key, "9007199254740992", function (err, res) {
|
||||||
helper.isNotError()(err, res);
|
helper.isNotError()(err, res);
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@@ -52,7 +50,7 @@ describe("The 'incr' method", function () {
|
|||||||
9007199254740996 -> 9007199254740996
|
9007199254740996 -> 9007199254740996
|
||||||
9007199254740997 -> 9007199254740996
|
9007199254740997 -> 9007199254740996
|
||||||
*/
|
*/
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.set(key, "9007199254740992", function (err, res) {
|
client.set(key, "9007199254740992", function (err, res) {
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'info' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushall(done);
|
client.flushall(done);
|
||||||
});
|
});
|
||||||
|
@@ -14,7 +14,7 @@ describe("The 'keys' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushall(done);
|
client.flushall(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'mget' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb();
|
client.flushdb();
|
||||||
|
@@ -24,13 +24,11 @@ describe("The 'mset' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -45,7 +43,7 @@ describe("The 'mset' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'msetnx' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'randomkey' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'rename' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'renamenx' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'rpush' command", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sadd' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'scard' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -16,7 +16,7 @@ describe("The 'script' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sdiff' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sdiffstore' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -14,13 +14,11 @@ describe("The 'select' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns an error if redis is not connected", function (done) {
|
it("returns an error if redis is not connected", function (done) {
|
||||||
@@ -36,7 +34,7 @@ describe("The 'select' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -22,13 +22,11 @@ describe("The 'set' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.on('end', function () {
|
client.on('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -43,7 +41,7 @@ describe("The 'set' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'setex' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'setnx' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sinter' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sinterstore' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'sismember' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'slowlog' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'smembers' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'smove' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -40,7 +40,7 @@ describe("The 'sort' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb();
|
client.flushdb();
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'spop' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'srem' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sunion' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'sunionstore' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'ttl' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ describe("The 'type' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,7 @@ describe("The 'watch' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'zadd' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'zscan' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -13,7 +13,7 @@ describe("The 'zscore' method", function () {
|
|||||||
var client;
|
var client;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
|
@@ -135,7 +135,7 @@ describe("connection tests", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("emits error once if reconnecting after command has been executed but not yet returned without callback", function (done) {
|
it("emits error once if reconnecting after command has been executed but not yet returned without callback", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on('error', function(err) {
|
client.on('error', function(err) {
|
||||||
assert.strictEqual(err.code, 'UNCERTAIN_STATE');
|
assert.strictEqual(err.code, 'UNCERTAIN_STATE');
|
||||||
done();
|
done();
|
||||||
@@ -296,7 +296,7 @@ describe("connection tests", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("connects correctly with args", function (done) {
|
it("connects correctly with args", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("error", done);
|
client.on("error", done);
|
||||||
|
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
@@ -382,7 +382,7 @@ describe("connection tests", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("connects correctly even if the info command is not present on the redis server", function (done) {
|
it("connects correctly even if the info command is not present on the redis server", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.info = function (cb) {
|
client.info = function (cb) {
|
||||||
// Mock the result
|
// Mock the result
|
||||||
cb(new Error("ERR unknown command 'info'"));
|
cb(new Error("ERR unknown command 'info'"));
|
||||||
@@ -465,7 +465,7 @@ describe("connection tests", function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it("redis still loading <= 1000ms", function (done) {
|
it("redis still loading <= 1000ms", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
var tmp = client.info.bind(client);
|
var tmp = client.info.bind(client);
|
||||||
var end = helper.callFuncAfter(done, 3);
|
var end = helper.callFuncAfter(done, 3);
|
||||||
var delayed = false;
|
var delayed = false;
|
||||||
@@ -495,7 +495,7 @@ describe("connection tests", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("redis still loading > 1000ms", function (done) {
|
it("redis still loading > 1000ms", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
var tmp = client.info.bind(client);
|
var tmp = client.info.bind(client);
|
||||||
var end = helper.callFuncAfter(done, 3);
|
var end = helper.callFuncAfter(done, 3);
|
||||||
var delayed = false;
|
var delayed = false;
|
||||||
|
@@ -16,7 +16,7 @@ describe("detect_buffers", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
|
@@ -105,13 +105,11 @@ describe("The 'multi' method", function () {
|
|||||||
describe("when not connected", function () {
|
describe("when not connected", function () {
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.quit();
|
client.quit();
|
||||||
});
|
});
|
||||||
client.once('end', function () {
|
client.once('end', done);
|
||||||
return done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports an error", function (done) {
|
it("reports an error", function (done) {
|
||||||
@@ -133,7 +131,7 @@ describe("The 'multi' method", function () {
|
|||||||
describe("when connected", function () {
|
describe("when connected", function () {
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("connect", done);
|
client.once("connect", done);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -212,7 +210,7 @@ describe("The 'multi' method", function () {
|
|||||||
describe("when ready", function () {
|
describe("when ready", function () {
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
|
@@ -19,7 +19,7 @@ describe("The node_redis client", function () {
|
|||||||
|
|
||||||
describe("when connected", function () {
|
describe("when connected", function () {
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(done);
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
@@ -343,7 +343,23 @@ describe("The node_redis client", function () {
|
|||||||
domain.on('error', function (err) {
|
domain.on('error', function (err) {
|
||||||
assert.strictEqual(err.message, 'ohhhh noooo');
|
assert.strictEqual(err.message, 'ohhhh noooo');
|
||||||
domain.exit();
|
domain.exit();
|
||||||
return done();
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('catches all errors from within the domain', function (done) {
|
||||||
|
var domain = require('domain').create();
|
||||||
|
|
||||||
|
domain.run(function () {
|
||||||
|
// Trigger an error within the domain
|
||||||
|
client.end(true);
|
||||||
|
client.set('domain', 'value');
|
||||||
|
});
|
||||||
|
|
||||||
|
domain.on('error', function (err) {
|
||||||
|
assert.strictEqual(err.message, 'SET can\'t be processed. The connection has already been closed.');
|
||||||
|
domain.exit();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -351,7 +367,7 @@ describe("The node_redis client", function () {
|
|||||||
|
|
||||||
describe('monitor', function () {
|
describe('monitor', function () {
|
||||||
it('monitors commands on all other redis clients', function (done) {
|
it('monitors commands on all other redis clients', function (done) {
|
||||||
var monitorClient = redis.createClient.apply(redis.createClient, args);
|
var monitorClient = redis.createClient.apply(null, args);
|
||||||
var responses = [];
|
var responses = [];
|
||||||
|
|
||||||
monitorClient.monitor(function (err, res) {
|
monitorClient.monitor(function (err, res) {
|
||||||
@@ -474,7 +490,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("fires client.on('ready')", function (done) {
|
it("fires client.on('ready')", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(true, client.options.socket_nodelay);
|
assert.strictEqual(true, client.options.socket_nodelay);
|
||||||
client.quit();
|
client.quit();
|
||||||
@@ -486,7 +502,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('client is functional', function (done) {
|
it('client is functional', function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(true, client.options.socket_nodelay);
|
assert.strictEqual(true, client.options.socket_nodelay);
|
||||||
client.set(["set key 1", "set val"], helper.isString("OK"));
|
client.set(["set key 1", "set val"], helper.isString("OK"));
|
||||||
@@ -508,7 +524,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("fires client.on('ready')", function (done) {
|
it("fires client.on('ready')", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(false, client.options.socket_nodelay);
|
assert.strictEqual(false, client.options.socket_nodelay);
|
||||||
client.quit();
|
client.quit();
|
||||||
@@ -520,7 +536,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('client is functional', function (done) {
|
it('client is functional', function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(false, client.options.socket_nodelay);
|
assert.strictEqual(false, client.options.socket_nodelay);
|
||||||
client.set(["set key 1", "set val"], helper.isString("OK"));
|
client.set(["set key 1", "set val"], helper.isString("OK"));
|
||||||
@@ -539,7 +555,7 @@ describe("The node_redis client", function () {
|
|||||||
describe('defaults to true', function () {
|
describe('defaults to true', function () {
|
||||||
|
|
||||||
it("fires client.on('ready')", function (done) {
|
it("fires client.on('ready')", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(true, client.options.socket_nodelay);
|
assert.strictEqual(true, client.options.socket_nodelay);
|
||||||
client.quit();
|
client.quit();
|
||||||
@@ -551,7 +567,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('client is functional', function (done) {
|
it('client is functional', function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
assert.strictEqual(true, client.options.socket_nodelay);
|
assert.strictEqual(true, client.options.socket_nodelay);
|
||||||
client.set(["set key 1", "set val"], helper.isString("OK"));
|
client.set(["set key 1", "set val"], helper.isString("OK"));
|
||||||
@@ -599,7 +615,7 @@ describe("The node_redis client", function () {
|
|||||||
describe('protocol error', function () {
|
describe('protocol error', function () {
|
||||||
|
|
||||||
it("should gracefully recover and only fail on the already send commands", function (done) {
|
it("should gracefully recover and only fail on the already send commands", function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
client.on('error', function(err) {
|
client.on('error', function(err) {
|
||||||
assert.strictEqual(err.message, 'Protocol error, got "a" as reply type byte');
|
assert.strictEqual(err.message, 'Protocol error, got "a" as reply type byte');
|
||||||
// After the hard failure work properly again. The set should have been processed properly too
|
// After the hard failure work properly again. The set should have been processed properly too
|
||||||
|
@@ -17,7 +17,7 @@ describe("return_buffers", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(null, args);
|
||||||
var i = 1;
|
var i = 1;
|
||||||
if (args[2].detect_buffers) {
|
if (args[2].detect_buffers) {
|
||||||
// Test if detect_buffer option was deactivated
|
// Test if detect_buffer option was deactivated
|
||||||
|
@@ -111,7 +111,7 @@ describe("TLS connection tests", function () {
|
|||||||
tls: faulty_cert
|
tls: faulty_cert
|
||||||
});
|
});
|
||||||
client.on('error', function (err) {
|
client.on('error', function (err) {
|
||||||
assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT');
|
assert(/DEPTH_ZERO_SELF_SIGNED_CERT/.test(err.code || err.message), err);
|
||||||
client.end(true);
|
client.end(true);
|
||||||
});
|
});
|
||||||
client.set('foo', 'bar', function (err, res) {
|
client.set('foo', 'bar', function (err, res) {
|
||||||
|
Reference in New Issue
Block a user