You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Add simicolons and remove trailing whitespace
This commit is contained in:
@@ -36,7 +36,7 @@ describe("client authentication", function () {
|
|||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(redis.createClient, args);
|
||||||
|
|
||||||
client.once('error', function (error) {
|
client.once('error', function (error) {
|
||||||
assert.ok(/ERR invalid password/.test(error))
|
assert.ok(/ERR invalid password/.test(error));
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -47,7 +47,8 @@ describe("client authentication", function () {
|
|||||||
it('allows auth to be provided as part of redis url', function (done) {
|
it('allows auth to be provided as part of redis url', function (done) {
|
||||||
client = redis.createClient('redis://foo:' + auth + '@' + config.HOST[ip] + ':' + config.PORT);
|
client = redis.createClient('redis://foo:' + auth + '@' + config.HOST[ip] + ':' + config.PORT);
|
||||||
client.on("ready", function () {
|
client.on("ready", function () {
|
||||||
return done() });
|
return done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,11 +19,10 @@ describe("The 'client' method", function () {
|
|||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
if (!helper.serverVersionAtLeast(client, [2, 4, 0])) {
|
if (!helper.serverVersionAtLeast(client, [2, 4, 0])) {
|
||||||
err = Error('script not supported in redis <= 2.4.0')
|
err = Error('script not supported in redis <= 2.4.0');
|
||||||
}
|
}
|
||||||
return done(err);
|
return done(err);
|
||||||
|
});
|
||||||
})
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -39,15 +38,15 @@ describe("The 'client' method", function () {
|
|||||||
it("lists connected clients when invoked with multi's chaining syntax", function (done) {
|
it("lists connected clients when invoked with multi's chaining syntax", function (done) {
|
||||||
client.multi().client("list").exec(function(err, results) {
|
client.multi().client("list").exec(function(err, results) {
|
||||||
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
||||||
return done()
|
return done();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lists connected clients when invoked with multi's array syntax", function (done) {
|
it("lists connected clients when invoked with multi's array syntax", function (done) {
|
||||||
client.multi().client("list").exec(function(err, results) {
|
client.multi().client("list").exec(function(err, results) {
|
||||||
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
assert(pattern.test(results[0]), "expected string '" + results + "' to match " + pattern.toString());
|
||||||
return done()
|
return done();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -19,10 +19,10 @@ describe("The 'eval' method", function () {
|
|||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
if (!helper.serverVersionAtLeast(client, [2, 5, 0])) {
|
if (!helper.serverVersionAtLeast(client, [2, 5, 0])) {
|
||||||
err = Error('exec not supported in redis <= 2.5.0')
|
err = Error('exec not supported in redis <= 2.5.0');
|
||||||
}
|
}
|
||||||
return done(err);
|
return done(err);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ describe("The 'hmset' method", function () {
|
|||||||
assert.equal(obj['0123456789'], 'abcdefghij');
|
assert.equal(obj['0123456789'], 'abcdefghij');
|
||||||
assert.equal(obj['some manner of key'], 'a type of value');
|
assert.equal(obj['some manner of key'], 'a type of value');
|
||||||
return done(err);
|
return done(err);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles object-style syntax', function (done) {
|
it('handles object-style syntax', function (done) {
|
||||||
@@ -36,7 +36,7 @@ describe("The 'hmset' method", function () {
|
|||||||
assert.equal(obj['0123456789'], 'abcdefghij');
|
assert.equal(obj['0123456789'], 'abcdefghij');
|
||||||
assert.equal(obj['some manner of key'], 'a type of value');
|
assert.equal(obj['some manner of key'], 'a type of value');
|
||||||
return done(err);
|
return done(err);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles object-style syntax and the key being a number', function (done) {
|
it('handles object-style syntax and the key being a number', function (done) {
|
||||||
|
@@ -47,11 +47,11 @@ describe("The 'hset' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not error when a buffer and array are set as fields on the same hash', function (done) {
|
it('does not error when a buffer and array are set as fields on the same hash', function (done) {
|
||||||
var hash = "test hash"
|
var hash = "test hash";
|
||||||
var field1 = "buffer"
|
var field1 = "buffer";
|
||||||
var value1 = new Buffer("abcdefghij")
|
var value1 = new Buffer("abcdefghij");
|
||||||
var field2 = "array"
|
var field2 = "array";
|
||||||
var value2 = ["array contents"]
|
var value2 = ["array contents"];
|
||||||
|
|
||||||
client.HMSET(hash, field1, value1, field2, value2, helper.isString("OK", done));
|
client.HMSET(hash, field1, value1, field2, value2, helper.isString("OK", done));
|
||||||
});
|
});
|
||||||
|
@@ -50,7 +50,7 @@ describe("The 'multi' method", function () {
|
|||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ describe("The 'renamenx' method", function () {
|
|||||||
client.renamenx('foo', 'foo2', helper.isNumber(0));
|
client.renamenx('foo', 'foo2', helper.isNumber(0));
|
||||||
client.exists('foo', helper.isNumber(1));
|
client.exists('foo', helper.isNumber(1));
|
||||||
client.exists(['foo2'], helper.isNumber(1, done));
|
client.exists(['foo2'], helper.isNumber(1, done));
|
||||||
})
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
client.end();
|
client.end();
|
||||||
|
@@ -21,11 +21,10 @@ describe("The 'script' method", function () {
|
|||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
if (!helper.serverVersionAtLeast(client, [2, 6, 0])) {
|
if (!helper.serverVersionAtLeast(client, [2, 6, 0])) {
|
||||||
err = Error('script not supported in redis <= 2.6.0')
|
err = Error('script not supported in redis <= 2.6.0');
|
||||||
}
|
}
|
||||||
return done(err);
|
return done(err);
|
||||||
|
});
|
||||||
})
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -42,21 +41,21 @@ describe("The 'script' method", function () {
|
|||||||
|
|
||||||
it('allows a loaded script to be evaluated', function (done) {
|
it('allows a loaded script to be evaluated', function (done) {
|
||||||
client.evalsha(commandSha, 0, helper.isString('99', done));
|
client.evalsha(commandSha, 0, helper.isString('99', done));
|
||||||
})
|
});
|
||||||
|
|
||||||
it('allows a script to be loaded as part of a chained transaction', function (done) {
|
it('allows a script to be loaded as part of a chained transaction', function (done) {
|
||||||
client.multi().script("load", command).exec(function(err, result) {
|
client.multi().script("load", command).exec(function(err, result) {
|
||||||
assert.strictEqual(result[0], commandSha);
|
assert.strictEqual(result[0], commandSha);
|
||||||
return done()
|
return done();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
it("allows a script to be loaded using a transaction's array syntax", function (done) {
|
it("allows a script to be loaded using a transaction's array syntax", function (done) {
|
||||||
client.multi([['script', 'load', command]]).exec(function(err, result) {
|
client.multi([['script', 'load', command]]).exec(function(err, result) {
|
||||||
assert.strictEqual(result[0], commandSha);
|
assert.strictEqual(result[0], commandSha);
|
||||||
return done()
|
return done();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -70,7 +70,7 @@ describe("The 'select' method", function () {
|
|||||||
it("emits an error", function (done) {
|
it("emits an error", function (done) {
|
||||||
assert.strictEqual(client.selected_db, null, "default db should be null");
|
assert.strictEqual(client.selected_db, null, "default db should be null");
|
||||||
client.select(9999, function (err) {
|
client.select(9999, function (err) {
|
||||||
assert.equal(err.message, 'ERR invalid DB index')
|
assert.equal(err.message, 'ERR invalid DB index');
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -17,7 +17,7 @@ describe("The 'sort' method", function () {
|
|||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb();
|
client.flushdb();
|
||||||
setupData(client, done)
|
setupData(client, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -20,11 +20,10 @@ describe("The 'watch' method", function () {
|
|||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(function (err) {
|
client.flushdb(function (err) {
|
||||||
if (!helper.serverVersionAtLeast(client, [2, 2, 0])) {
|
if (!helper.serverVersionAtLeast(client, [2, 2, 0])) {
|
||||||
err = Error('some watch commands not supported in redis <= 2.2.0')
|
err = Error('some watch commands not supported in redis <= 2.2.0');
|
||||||
}
|
}
|
||||||
return done(err);
|
return done(err);
|
||||||
|
});
|
||||||
})
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ describe("The 'watch' method", function () {
|
|||||||
var multi = client.multi();
|
var multi = client.multi();
|
||||||
multi.incr(watched);
|
multi.incr(watched);
|
||||||
multi.exec(helper.isNull(done));
|
multi.exec(helper.isNull(done));
|
||||||
})
|
});
|
||||||
|
|
||||||
it('successfully modifies other keys independently of transaction', function (done) {
|
it('successfully modifies other keys independently of transaction', function (done) {
|
||||||
client.set("unwatched", 200);
|
client.set("unwatched", 200);
|
||||||
|
@@ -20,7 +20,7 @@ if (!process.env.REDIS_TESTS_STARTED) {
|
|||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
startRedis('./conf/redis.conf', done);
|
startRedis('./conf/redis.conf', done);
|
||||||
})
|
});
|
||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
if (rp) rp.stop(done);
|
if (rp) rp.stop(done);
|
||||||
|
@@ -16,7 +16,7 @@ var config = {
|
|||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
if (ip.match(/\.sock/)) {
|
if (ip.match(/\.sock/)) {
|
||||||
args.push(ip)
|
args.push(ip);
|
||||||
} else {
|
} else {
|
||||||
args.push(config.PORT);
|
args.push(config.PORT);
|
||||||
args.push(config.HOST[ip]);
|
args.push(config.HOST[ip]);
|
||||||
|
@@ -58,7 +58,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
waitForRedis(false, function () {
|
waitForRedis(false, function () {
|
||||||
return done(error);
|
return done(error);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
rp.kill("SIGTERM");
|
rp.kill("SIGTERM");
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
var redis = require("../../");
|
var redis = require("../../");
|
||||||
var HOST = process.argv[2] || '127.0.0.1';
|
var HOST = process.argv[2] || '127.0.0.1';
|
||||||
var PORT = process.argv[3]
|
var PORT = process.argv[3];
|
||||||
var args = PORT ? [PORT, HOST] : [HOST]
|
var args = PORT ? [PORT, HOST] : [HOST];
|
||||||
|
|
||||||
var c = redis.createClient.apply(redis, args);
|
var c = redis.createClient.apply(redis, args);
|
||||||
c.unref();
|
c.unref();
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
var async = require("async");
|
var async = require("async");
|
||||||
var assert = require("assert");
|
var assert = require("assert");
|
||||||
var config = require("./lib/config");
|
var config = require("./lib/config");
|
||||||
var helper = require('./helper')
|
var helper = require('./helper');
|
||||||
var fork = require("child_process").fork;
|
var fork = require("child_process").fork;
|
||||||
var redis = config.redis;
|
var redis = config.redis;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ describe("The node_redis client", function () {
|
|||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(redis.createClient, args);
|
||||||
client.once("error", done);
|
client.once("error", done);
|
||||||
client.once("connect", function () {
|
client.once("connect", function () {
|
||||||
client.flushdb(done)
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -124,23 +124,19 @@ describe("The node_redis client", function () {
|
|||||||
client.on("connect", function on_connect() {
|
client.on("connect", function on_connect() {
|
||||||
async.parallel([function (cb) {
|
async.parallel([function (cb) {
|
||||||
client.get("recon 1", function (err, res) {
|
client.get("recon 1", function (err, res) {
|
||||||
helper.isString("one")(err, res);
|
helper.isString("one", cb)(err, res);
|
||||||
cb();
|
|
||||||
});
|
});
|
||||||
}, function (cb) {
|
}, function (cb) {
|
||||||
client.get("recon 1", function (err, res) {
|
client.get("recon 1", function (err, res) {
|
||||||
helper.isString("one")(err, res);
|
helper.isString("one", cb)(err, res);
|
||||||
cb();
|
|
||||||
});
|
});
|
||||||
}, function (cb) {
|
}, function (cb) {
|
||||||
client.get("recon 2", function (err, res) {
|
client.get("recon 2", function (err, res) {
|
||||||
helper.isString("two")(err, res);
|
helper.isString("two", cb)(err, res);
|
||||||
cb();
|
|
||||||
});
|
});
|
||||||
}, function (cb) {
|
}, function (cb) {
|
||||||
client.get("recon 2", function (err, res) {
|
client.get("recon 2", function (err, res) {
|
||||||
helper.isString("two")(err, res);
|
helper.isString("two", cb)(err, res);
|
||||||
cb();
|
|
||||||
});
|
});
|
||||||
}], function (err, results) {
|
}], function (err, results) {
|
||||||
client.removeListener("connect", on_connect);
|
client.removeListener("connect", on_connect);
|
||||||
@@ -266,7 +262,7 @@ describe("The node_redis client", function () {
|
|||||||
// this is the expected and desired behavior
|
// this is the expected and desired behavior
|
||||||
domain.on('error', function (err) {
|
domain.on('error', function (err) {
|
||||||
domain.exit();
|
domain.exit();
|
||||||
return done()
|
return done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -680,7 +676,7 @@ describe("The node_redis client", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("sets upper bound on how long client waits before reconnecting", function (done) {
|
it("sets upper bound on how long client waits before reconnecting", function (done) {
|
||||||
var time = new Date().getTime()
|
var time = new Date().getTime();
|
||||||
var reconnecting = false;
|
var reconnecting = false;
|
||||||
|
|
||||||
client = redis.createClient.apply(redis.createClient, args);
|
client = redis.createClient.apply(redis.createClient, args);
|
||||||
|
@@ -46,7 +46,7 @@ describe("publish/subscribe", function () {
|
|||||||
it('fires a subscribe event for each channel subscribed to', function (done) {
|
it('fires a subscribe event for each channel subscribed to', function (done) {
|
||||||
sub.on("subscribe", function (chnl, count) {
|
sub.on("subscribe", function (chnl, count) {
|
||||||
if (chnl === channel2) {
|
if (chnl === channel2) {
|
||||||
assert.equal(2, count)
|
assert.equal(2, count);
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -169,7 +169,7 @@ describe("publish/subscribe", function () {
|
|||||||
describe('unsubscribe', function () {
|
describe('unsubscribe', function () {
|
||||||
it('fires an unsubscribe event', function (done) {
|
it('fires an unsubscribe event', function (done) {
|
||||||
sub.on("subscribe", function (chnl, count) {
|
sub.on("subscribe", function (chnl, count) {
|
||||||
sub.unsubscribe(channel)
|
sub.unsubscribe(channel);
|
||||||
});
|
});
|
||||||
|
|
||||||
sub.subscribe(channel);
|
sub.subscribe(channel);
|
||||||
@@ -183,7 +183,7 @@ describe("publish/subscribe", function () {
|
|||||||
|
|
||||||
it('puts client back into write mode', function (done) {
|
it('puts client back into write mode', function (done) {
|
||||||
sub.on("subscribe", function (chnl, count) {
|
sub.on("subscribe", function (chnl, count) {
|
||||||
sub.unsubscribe(channel)
|
sub.unsubscribe(channel);
|
||||||
});
|
});
|
||||||
|
|
||||||
sub.subscribe(channel);
|
sub.subscribe(channel);
|
||||||
@@ -191,10 +191,10 @@ describe("publish/subscribe", function () {
|
|||||||
sub.on("unsubscribe", function (chnl, count) {
|
sub.on("unsubscribe", function (chnl, count) {
|
||||||
pub.incr("foo", helper.isNumber(1, done));
|
pub.incr("foo", helper.isNumber(1, done));
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
it('does not complain when unsubscribe is called and there are no subscriptions', function () {
|
it('does not complain when unsubscribe is called and there are no subscriptions', function () {
|
||||||
sub.unsubscribe()
|
sub.unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('executes callback when unsubscribe is called and there are no subscriptions', function (done) {
|
it('executes callback when unsubscribe is called and there are no subscriptions', function (done) {
|
||||||
@@ -217,15 +217,15 @@ describe("publish/subscribe", function () {
|
|||||||
assert.strictEqual(channel, '/foo');
|
assert.strictEqual(channel, '/foo');
|
||||||
assert.strictEqual(message, 'hello world');
|
assert.strictEqual(message, 'hello world');
|
||||||
return done();
|
return done();
|
||||||
})
|
});
|
||||||
pub.publish('/foo', 'hello world');
|
pub.publish('/foo', 'hello world');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('punsubscribe', function () {
|
describe('punsubscribe', function () {
|
||||||
it('does not complain when punsubscribe is called and there are no subscriptions', function () {
|
it('does not complain when punsubscribe is called and there are no subscriptions', function () {
|
||||||
sub.punsubscribe()
|
sub.punsubscribe();
|
||||||
})
|
});
|
||||||
|
|
||||||
it('executes callback when punsubscribe is called and there are no subscriptions', function (done) {
|
it('executes callback when punsubscribe is called and there are no subscriptions', function (done) {
|
||||||
// test hangs on older versions of redis, so skip
|
// test hangs on older versions of redis, so skip
|
||||||
|
Reference in New Issue
Block a user