1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Refactor the test suite and remove duplicated code

This commit is contained in:
Ruben Bridgewater
2015-09-01 23:24:28 +02:00
parent ac63e852d3
commit a5938f3ade
52 changed files with 68 additions and 459 deletions

View File

@@ -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) {

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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;
@@ -36,12 +35,5 @@ describe("The 'setex' method", function () {
client.end();
});
});
}
['javascript', 'hiredis'].forEach(function (parser) {
allTests(parser, "/tmp/redis.sock");
['IPv4', 'IPv6'].forEach(function (ip) {
allTests(parser, ip);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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);
})
});
});

View File

@@ -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));
});
});
}
}

View File

@@ -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);
});
});
});

View File

@@ -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);
})
});
});