diff --git a/test/auth.spec.js b/test/auth.spec.js index 000bb81a66..63ce1cf9ff 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -11,7 +11,8 @@ describe("client authentication", function () { }); }); - function allTests(parser, ip) { + helper.allTests(function(parser, ip, args) { + describe("using " + parser + " and " + ip, function () { var args = config.configureClient(parser, ip); var auth = 'porkchopsandwiches'; @@ -73,13 +74,6 @@ describe("client authentication", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); after(function (done) { diff --git a/test/commands/blpop.spec.js b/test/commands/blpop.spec.js index 1e344e023b..e547415438 100644 --- a/test/commands/blpop.spec.js +++ b/test/commands/blpop.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'blpop' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -53,12 +52,5 @@ describe("The 'blpop' method", function () { bclient.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/client.spec.js b/test/commands/client.spec.js index 3710bdc9ed..d0ae072f9f 100644 --- a/test/commands/client.spec.js +++ b/test/commands/client.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'client' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { var pattern = /addr=/; describe("using " + parser + " and " + ip, function () { @@ -50,12 +49,5 @@ describe("The 'client' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/dbsize.spec.js b/test/commands/dbsize.spec.js index 70c7eb178c..d65e9469b2 100644 --- a/test/commands/dbsize.spec.js +++ b/test/commands/dbsize.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'dbsize' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value; @@ -95,12 +94,5 @@ describe("The 'dbsize' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/del.spec.js b/test/commands/del.spec.js index b2b2995c48..6845ee363f 100644 --- a/test/commands/del.spec.js +++ b/test/commands/del.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'del' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -40,12 +39,5 @@ describe("The 'del' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/eval.spec.js b/test/commands/eval.spec.js index a98efa032e..d132e7c2a9 100644 --- a/test/commands/eval.spec.js +++ b/test/commands/eval.spec.js @@ -5,8 +5,8 @@ var helper = require("../helper"); var redis = config.redis; describe("The 'eval' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -188,12 +188,5 @@ describe("The 'eval' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/exits.spec.js b/test/commands/exits.spec.js index b3f04badcc..c36e9bcfed 100644 --- a/test/commands/exits.spec.js +++ b/test/commands/exits.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'exits' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -32,12 +31,5 @@ describe("The 'exits' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/expire.spec.js b/test/commands/expire.spec.js index eab08468e9..8e7d3a188e 100644 --- a/test/commands/expire.spec.js +++ b/test/commands/expire.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'expire' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -31,12 +30,5 @@ describe("The 'expire' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/flushdb.spec.js b/test/commands/flushdb.spec.js index 8df39f4752..80533d3462 100644 --- a/test/commands/flushdb.spec.js +++ b/test/commands/flushdb.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'flushdb' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, key2; @@ -104,12 +103,5 @@ describe("The 'flushdb' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/get.spec.js b/test/commands/get.spec.js index 31502c2c4b..4ba2621f0f 100644 --- a/test/commands/get.spec.js +++ b/test/commands/get.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'get' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value; @@ -81,12 +80,5 @@ describe("The 'get' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/getset.spec.js b/test/commands/getset.spec.js index a8e90ecfa2..f3c294a669 100644 --- a/test/commands/getset.spec.js +++ b/test/commands/getset.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'getset' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value, value2; @@ -85,12 +84,5 @@ describe("The 'getset' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hgetall.spec.js b/test/commands/hgetall.spec.js index c49988157e..aa3e520ceb 100644 --- a/test/commands/hgetall.spec.js +++ b/test/commands/hgetall.spec.js @@ -5,7 +5,8 @@ var redis = config.redis; describe("The 'hgetall' method", function () { - function allTests(parser, ip) { + helper.allTests(function(parser, ip, args) { + describe("using " + parser + " and " + ip, function () { var client; @@ -80,12 +81,5 @@ describe("The 'hgetall' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hincrby.spec.js b/test/commands/hincrby.spec.js index f137405f78..b1da736027 100644 --- a/test/commands/hincrby.spec.js +++ b/test/commands/hincrby.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'hincrby' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -37,12 +36,5 @@ describe("The 'hincrby' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hlen.spec.js b/test/commands/hlen.spec.js index 11905809c1..7756e3366b 100644 --- a/test/commands/hlen.spec.js +++ b/test/commands/hlen.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'hlen' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -35,12 +34,5 @@ describe("The 'hlen' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hmget.spec.js b/test/commands/hmget.spec.js index fbced263bb..3ad8fa9128 100644 --- a/test/commands/hmget.spec.js +++ b/test/commands/hmget.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'hmget' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -57,12 +56,5 @@ describe("The 'hmget' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hmset.spec.js b/test/commands/hmset.spec.js index d0f23eb066..e30669d00e 100644 --- a/test/commands/hmset.spec.js +++ b/test/commands/hmset.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'hmset' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -50,12 +49,5 @@ describe("The 'hmset' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/hset.spec.js b/test/commands/hset.spec.js index 0ce2432ea9..668838b60d 100644 --- a/test/commands/hset.spec.js +++ b/test/commands/hset.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'hset' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -59,12 +58,5 @@ describe("The 'hset' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/incr.spec.js b/test/commands/incr.spec.js index bdd22bacf1..4e06427933 100644 --- a/test/commands/incr.spec.js +++ b/test/commands/incr.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'incr' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key = "sequence"; @@ -113,12 +112,5 @@ describe("The 'incr' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/keys.spec.js b/test/commands/keys.spec.js index b1f5f9cb51..07add24650 100644 --- a/test/commands/keys.spec.js +++ b/test/commands/keys.spec.js @@ -6,8 +6,7 @@ var redis = config.redis; describe("The 'keys' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -65,12 +64,5 @@ describe("The 'keys' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/mget.spec.js b/test/commands/mget.spec.js index 1169b5949f..c4052a17fd 100644 --- a/test/commands/mget.spec.js +++ b/test/commands/mget.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'mget' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -55,12 +54,5 @@ describe("The 'mget' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/mset.spec.js b/test/commands/mset.spec.js index d15c70c1a4..aacb969c69 100644 --- a/test/commands/mset.spec.js +++ b/test/commands/mset.spec.js @@ -13,8 +13,7 @@ describe("The 'mset' method", function () { return mochaListener; } - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value, key2, value2; @@ -130,12 +129,5 @@ describe("The 'mset' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/msetnx.spec.js b/test/commands/msetnx.spec.js index ddbb893c1a..ef7cf63e9f 100644 --- a/test/commands/msetnx.spec.js +++ b/test/commands/msetnx.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'msetnx' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -35,12 +34,5 @@ describe("The 'msetnx' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/multi.spec.js b/test/commands/multi.spec.js index 21526334a1..f99e85211f 100644 --- a/test/commands/multi.spec.js +++ b/test/commands/multi.spec.js @@ -7,8 +7,7 @@ var uuid = require('uuid'); describe("The 'multi' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value; @@ -239,12 +238,5 @@ describe("The 'multi' method", function () { }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/randomkey.test.js b/test/commands/randomkey.test.js index 7549800394..ef11253adb 100644 --- a/test/commands/randomkey.test.js +++ b/test/commands/randomkey.test.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'randomkey' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -31,12 +30,5 @@ describe("The 'randomkey' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/rename.spec.js b/test/commands/rename.spec.js index be2145923d..3389fa59da 100644 --- a/test/commands/rename.spec.js +++ b/test/commands/rename.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'rename' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -35,12 +34,5 @@ describe("The 'rename' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/renamenx.spec.js b/test/commands/renamenx.spec.js index 6dd1a1b0d6..233d1aaba5 100644 --- a/test/commands/renamenx.spec.js +++ b/test/commands/renamenx.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'renamenx' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -38,12 +37,5 @@ describe("The 'renamenx' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sadd.spec.js b/test/commands/sadd.spec.js index ea63a637ea..a6a8ac4330 100644 --- a/test/commands/sadd.spec.js +++ b/test/commands/sadd.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sadd' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -47,12 +46,5 @@ describe("The 'sadd' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/scard.spec.js b/test/commands/scard.spec.js index 4030e27b95..180da0a98e 100644 --- a/test/commands/scard.spec.js +++ b/test/commands/scard.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'scard' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -28,12 +27,5 @@ describe("The 'scard' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/script.spec.js b/test/commands/script.spec.js index df3d8aa486..80cbf1abc0 100644 --- a/test/commands/script.spec.js +++ b/test/commands/script.spec.js @@ -6,8 +6,7 @@ var redis = config.redis; describe("The 'script' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { var command = "return 99"; var commandSha = crypto.createHash('sha1').update(command).digest('hex'); @@ -57,12 +56,5 @@ describe("The 'script' method", function () { }) }) }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sdiff.spec.js b/test/commands/sdiff.spec.js index deb0628326..0e233f26ff 100644 --- a/test/commands/sdiff.spec.js +++ b/test/commands/sdiff.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sdiff' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -43,12 +42,5 @@ describe("The 'sdiff' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sdiffstore.spec.js b/test/commands/sdiffstore.spec.js index 2aac531b4f..c497cf47e2 100644 --- a/test/commands/sdiffstore.spec.js +++ b/test/commands/sdiffstore.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sdiffstore' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -43,12 +42,5 @@ describe("The 'sdiffstore' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/select.spec.js b/test/commands/select.spec.js index 1be845dc00..dac3c8b34c 100644 --- a/test/commands/select.spec.js +++ b/test/commands/select.spec.js @@ -12,8 +12,7 @@ describe("The 'select' method", function () { return mochaListener; } - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { describe("when not connected", function () { @@ -112,12 +111,5 @@ describe("The 'select' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/set.spec.js b/test/commands/set.spec.js index b9bbe79c85..28455c9ebe 100644 --- a/test/commands/set.spec.js +++ b/test/commands/set.spec.js @@ -13,8 +13,7 @@ describe("The 'set' method", function () { return mochaListener; } - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var key, value; @@ -154,12 +153,5 @@ describe("The 'set' method", function () { }); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/setex.spec.js b/test/commands/setex.spec.js index d66366785e..b4e6189168 100644 --- a/test/commands/setex.spec.js +++ b/test/commands/setex.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'setex' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -31,17 +30,10 @@ describe("The 'setex' method", function () { it('returns an error if no value is provided', function (done) { client.SETEX(["setex key", "100", undefined], helper.isError(done)); }); - + afterEach(function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/setnx.spec.js b/test/commands/setnx.spec.js index 92f892516a..9b363a32fd 100644 --- a/test/commands/setnx.spec.js +++ b/test/commands/setnx.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'setnx' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -35,12 +34,5 @@ describe("The 'setnx' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sinter.spec.js b/test/commands/sinter.spec.js index c1b89051cf..6bc87390bb 100644 --- a/test/commands/sinter.spec.js +++ b/test/commands/sinter.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sinter' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -59,12 +58,5 @@ describe("The 'sinter' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sinterstore.spec.js b/test/commands/sinterstore.spec.js index f27d47eea6..7cf783bf25 100644 --- a/test/commands/sinterstore.spec.js +++ b/test/commands/sinterstore.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sinterstore' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -44,12 +43,5 @@ describe("The 'sinterstore' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sismember.spec.js b/test/commands/sismember.spec.js index 7277692c46..fdc00da1da 100644 --- a/test/commands/sismember.spec.js +++ b/test/commands/sismember.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sismember' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -32,12 +31,5 @@ describe("The 'sismember' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/slowlog.spec.js b/test/commands/slowlog.spec.js index d09442d529..b2d304911b 100644 --- a/test/commands/slowlog.spec.js +++ b/test/commands/slowlog.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'slowlog' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -37,12 +36,5 @@ describe("The 'slowlog' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/smembers.spec.js b/test/commands/smembers.spec.js index 0832742ec0..39bca826bc 100644 --- a/test/commands/smembers.spec.js +++ b/test/commands/smembers.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'smembers' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -34,12 +33,5 @@ describe("The 'smembers' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/smove.spec.js b/test/commands/smove.spec.js index 598be28860..d9ad3c4021 100644 --- a/test/commands/smove.spec.js +++ b/test/commands/smove.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'smove' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -37,12 +36,5 @@ describe("The 'smove' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sort.spec.js b/test/commands/sort.spec.js index b40b63cf32..c38dfd4685 100644 --- a/test/commands/sort.spec.js +++ b/test/commands/sort.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sort' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -90,7 +89,7 @@ describe("The 'sort' method", function () { client.end(); }); }); - } + }); function setupData(client, done) { client.rpush('y', 'd'); @@ -119,10 +118,4 @@ describe("The 'sort' method", function () { client.set('p9', 'tux', done); } - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) - }); }); diff --git a/test/commands/spop.spec.js b/test/commands/spop.spec.js index 43b31442e2..75470d5562 100644 --- a/test/commands/spop.spec.js +++ b/test/commands/spop.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'spop' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -34,12 +33,5 @@ describe("The 'spop' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/srem.spec.js b/test/commands/srem.spec.js index f0a140e39a..af456abf10 100644 --- a/test/commands/srem.spec.js +++ b/test/commands/srem.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'srem' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -55,12 +54,5 @@ describe("The 'srem' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sunion.spec.js b/test/commands/sunion.spec.js index 92cd81d08f..bf61c5e680 100644 --- a/test/commands/sunion.spec.js +++ b/test/commands/sunion.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sunion' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -42,12 +41,5 @@ describe("The 'sunion' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/sunionstore.spec.js b/test/commands/sunionstore.spec.js index 702ad131c1..644bb8744b 100644 --- a/test/commands/sunionstore.spec.js +++ b/test/commands/sunionstore.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'sunionstore' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -45,12 +44,5 @@ describe("The 'sunionstore' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/ttl.spec.js b/test/commands/ttl.spec.js index cc93d231e1..c8988ab05b 100644 --- a/test/commands/ttl.spec.js +++ b/test/commands/ttl.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'ttl' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -34,12 +33,5 @@ describe("The 'ttl' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/commands/type.spec.js b/test/commands/type.spec.js index 57aa745da1..5c438bbd17 100644 --- a/test/commands/type.spec.js +++ b/test/commands/type.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("The 'type' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -52,12 +51,6 @@ describe("The 'type' method", function () { client.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); + }); diff --git a/test/commands/watch.spec.js b/test/commands/watch.spec.js index 8494d35dd5..a4abdce877 100644 --- a/test/commands/watch.spec.js +++ b/test/commands/watch.spec.js @@ -5,9 +5,9 @@ var redis = config.redis; describe("The 'watch' method", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); - var watched = 'foobar' + helper.allTests(function(parser, ip, args) { + + var watched = 'foobar'; describe("using " + parser + " and " + ip, function () { var client; @@ -57,12 +57,5 @@ describe("The 'watch' method", function () { }); }) }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); }); diff --git a/test/helper.js b/test/helper.js index 8aaa4d68d4..74404b2630 100644 --- a/test/helper.js +++ b/test/helper.js @@ -1,5 +1,6 @@ var assert = require("assert"); var path = require('path'); +var config = require("./lib/config"); var RedisProcess = require("./lib/redis-process"); var rp; @@ -89,6 +90,14 @@ module.exports = { if (version[i] < desired_version[i]) return false; } return true; + }, + allTests: function (cb) { + ['javascript', 'hiredis'].forEach(function (parser) { + cb(parser, "/tmp/redis.sock", config.configureClient(parser, "/tmp/redis.sock")); + ['IPv4', 'IPv6'].forEach(function (ip) { + cb(parser, ip, config.configureClient(parser, ip)); + }); + }); } } diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index 7e88886a30..580e3e127e 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -7,8 +7,7 @@ var redis = config.redis; describe("The node_redis client", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var client; @@ -681,12 +680,5 @@ describe("The node_redis client", function () { }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }); }); }); diff --git a/test/pubsub.spec.js b/test/pubsub.spec.js index 7678fd45bf..3e6ad9ba68 100644 --- a/test/pubsub.spec.js +++ b/test/pubsub.spec.js @@ -5,8 +5,7 @@ var redis = config.redis; describe("publish/subscribe", function () { - function allTests(parser, ip) { - var args = config.configureClient(parser, ip); + helper.allTests(function(parser, ip, args) { describe("using " + parser + " and " + ip, function () { var pub = null; @@ -243,12 +242,5 @@ describe("publish/subscribe", function () { pub.end(); }); }); - } - - ['javascript', 'hiredis'].forEach(function (parser) { - allTests(parser, "/tmp/redis.sock"); - ['IPv4', 'IPv6'].forEach(function (ip) { - allTests(parser, ip); - }) }); });