From 2293f7ff85dbcd6714b2d6bafebfc787b67eac71 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 19 Sep 2015 18:01:22 +0200 Subject: [PATCH] Add some more tests --- index.js | 1 - test/commands/eval.spec.js | 1 + test/commands/multi.spec.js | 1 + test/commands/select.spec.js | 4 +++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bd71db1866..9e93ef3c5e 100644 --- a/index.js +++ b/index.js @@ -1060,7 +1060,6 @@ Multi.prototype.execute_callback = function (err, replies) { if (err) { if (err.code !== 'CONNECTION_BROKEN') { - err.code = 'EXECABORT'; err.errors = this.errors; if (this.callback) { this.callback(err); diff --git a/test/commands/eval.spec.js b/test/commands/eval.spec.js index 234547cd48..cfbaefa82b 100644 --- a/test/commands/eval.spec.js +++ b/test/commands/eval.spec.js @@ -128,6 +128,7 @@ describe("The 'eval' method", function () { helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0); client.on('error', function(err) { + assert.equal(err.code, 'NOSCRIPT'); assert(/NOSCRIPT No matching script. Please use EVAL./.test(err.message)); done(); }); diff --git a/test/commands/multi.spec.js b/test/commands/multi.spec.js index 60ac2e07fa..e6c72d01dc 100644 --- a/test/commands/multi.spec.js +++ b/test/commands/multi.spec.js @@ -263,6 +263,7 @@ describe("The 'multi' method", function () { it('reports multiple exceptions when they occur (while EXEC is running)', function (done) { client.multi().config("bar").debug("foo").exec(function (err, reply) { assert.strictEqual(reply.length, 2); + assert.equal(reply[0].code, 'ERR'); assert(/^ERR/.test(reply[0].message), "Error message should begin with ERR"); assert(/^ERR/.test(reply[1].message), "Error message should begin with ERR"); return done(); diff --git a/test/commands/select.spec.js b/test/commands/select.spec.js index 1ad7de94c1..c02b4de543 100644 --- a/test/commands/select.spec.js +++ b/test/commands/select.spec.js @@ -57,7 +57,8 @@ describe("The 'select' method", function () { describe("with a valid db index", function () { it("selects the appropriate database", function (done) { assert.strictEqual(client.selected_db, null, "default db should be null"); - client.select(1, function () { + client.select(1, function (err) { + assert.equal(err, null); assert.equal(client.selected_db, 1, "we should have selected the new valid DB"); return done(); }); @@ -68,6 +69,7 @@ describe("The 'select' method", function () { it("returns an error", function (done) { assert.strictEqual(client.selected_db, null, "default db should be null"); client.select(9999, function (err) { + assert.equal(err.code, 'ERR'); assert.equal(err.message, 'ERR invalid DB index'); return done(); });