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 support of redis 2.4
All tests require at least redis 2.6 from now on. Anyone who wants to run the tests should be able to install a newer version.
This commit is contained in:
@ -26,32 +26,26 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('converts a float to an integer when evaluated', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return 100.5", 0, helper.isNumber(100, done));
|
||||
});
|
||||
|
||||
it('returns a string', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return 'hello world'", 0, helper.isString('hello world', done));
|
||||
});
|
||||
|
||||
it('converts boolean true to integer 1', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return true", 0, helper.isNumber(1, done));
|
||||
});
|
||||
|
||||
it('converts boolean false to null', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return false", 0, helper.isNull(done));
|
||||
});
|
||||
|
||||
it('converts lua status code to string representation', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return {ok='fine'}", 0, helper.isString('fine', done));
|
||||
});
|
||||
|
||||
it('converts lua error to an error response', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return {err='this is an error'}", 0, function(err) {
|
||||
assert(err.code === undefined);
|
||||
helper.isError()(err);
|
||||
@ -60,7 +54,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('represents a lua table appropritely', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) {
|
||||
assert.strictEqual(5, res.length);
|
||||
assert.strictEqual(1, res[0]);
|
||||
@ -75,7 +68,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('populates keys and argv correctly', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) {
|
||||
assert.strictEqual(4, res.length);
|
||||
assert.strictEqual("a", res[0]);
|
||||
@ -87,7 +79,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('allows arguments to be provided in array rather than as multiple parameters', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) {
|
||||
assert.strictEqual(4, res.length);
|
||||
assert.strictEqual("a", res[0]);
|
||||
@ -99,7 +90,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('allows a script to be executed that accesses the redis API without callback', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval(source, 0);
|
||||
client.get('sha', helper.isString('test', done));
|
||||
});
|
||||
@ -108,24 +98,20 @@ describe("The 'eval' method", function () {
|
||||
var sha = crypto.createHash('sha1').update(source).digest('hex');
|
||||
|
||||
it('allows a script to be executed that accesses the redis API', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval(source, 0, helper.isString('OK'));
|
||||
client.get('sha', helper.isString('test', done));
|
||||
});
|
||||
|
||||
it('can execute a script if the SHA exists', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.evalsha(sha, 0, helper.isString('OK'));
|
||||
client.get('sha', helper.isString('test', done));
|
||||
});
|
||||
|
||||
it('returns an error if SHA does not exist', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0, helper.isError(done));
|
||||
});
|
||||
|
||||
it('emit an error if SHA does not exist without any callback', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0);
|
||||
client.on('error', function(err) {
|
||||
assert.equal(err.code, 'NOSCRIPT');
|
||||
@ -144,7 +130,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('allows a key to be incremented, and performs appropriate conversion from LUA type', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.set("incr key", 0, function (err, reply) {
|
||||
if (err) return done(err);
|
||||
client.eval("local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}", 0, function (err, res) {
|
||||
@ -157,7 +142,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('allows a bulk operation to be performed, and performs appropriate conversion from LUA type', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.set("bulk reply key", "bulk reply value", function (err, res) {
|
||||
client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) {
|
||||
assert.strictEqual(2, res.length);
|
||||
@ -169,7 +153,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('allows a multi mulk operation to be performed, with the appropriate type conversion', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.multi()
|
||||
.del("mylist")
|
||||
.rpush("mylist", "a")
|
||||
@ -190,7 +173,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('returns an appropriate representation of Lua status reply', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) {
|
||||
assert.strictEqual(2, res.length);
|
||||
assert.strictEqual("table", res[0]);
|
||||
@ -200,7 +182,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('returns an appropriate representation of a Lua error reply', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.set("error reply key", "error reply value", function (err, res) {
|
||||
if (err) return done(err);
|
||||
client.eval("local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}", 0, function (err, res) {
|
||||
@ -213,7 +194,6 @@ describe("The 'eval' method", function () {
|
||||
});
|
||||
|
||||
it('returns an appropriate representation of a Lua nil reply', function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||
client.del("nil reply key", function (err, res) {
|
||||
if (err) return done(err);
|
||||
client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) {
|
||||
|
Reference in New Issue
Block a user