You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Add some more tests
This commit is contained in:
1
index.js
1
index.js
@@ -1060,7 +1060,6 @@ Multi.prototype.execute_callback = function (err, replies) {
|
|||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code !== 'CONNECTION_BROKEN') {
|
if (err.code !== 'CONNECTION_BROKEN') {
|
||||||
err.code = 'EXECABORT';
|
|
||||||
err.errors = this.errors;
|
err.errors = this.errors;
|
||||||
if (this.callback) {
|
if (this.callback) {
|
||||||
this.callback(err);
|
this.callback(err);
|
||||||
|
@@ -128,6 +128,7 @@ describe("The 'eval' method", function () {
|
|||||||
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
|
||||||
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0);
|
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0);
|
||||||
client.on('error', function(err) {
|
client.on('error', function(err) {
|
||||||
|
assert.equal(err.code, 'NOSCRIPT');
|
||||||
assert(/NOSCRIPT No matching script. Please use EVAL./.test(err.message));
|
assert(/NOSCRIPT No matching script. Please use EVAL./.test(err.message));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -263,6 +263,7 @@ describe("The 'multi' method", function () {
|
|||||||
it('reports multiple exceptions when they occur (while EXEC is running)', function (done) {
|
it('reports multiple exceptions when they occur (while EXEC is running)', function (done) {
|
||||||
client.multi().config("bar").debug("foo").exec(function (err, reply) {
|
client.multi().config("bar").debug("foo").exec(function (err, reply) {
|
||||||
assert.strictEqual(reply.length, 2);
|
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[0].message), "Error message should begin with ERR");
|
||||||
assert(/^ERR/.test(reply[1].message), "Error message should begin with ERR");
|
assert(/^ERR/.test(reply[1].message), "Error message should begin with ERR");
|
||||||
return done();
|
return done();
|
||||||
|
@@ -57,7 +57,8 @@ describe("The 'select' method", function () {
|
|||||||
describe("with a valid db index", function () {
|
describe("with a valid db index", function () {
|
||||||
it("selects the appropriate database", function (done) {
|
it("selects the appropriate database", 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(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");
|
assert.equal(client.selected_db, 1, "we should have selected the new valid DB");
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
@@ -68,6 +69,7 @@ describe("The 'select' method", function () {
|
|||||||
it("returns an error", function (done) {
|
it("returns 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.code, 'ERR');
|
||||||
assert.equal(err.message, 'ERR invalid DB index');
|
assert.equal(err.message, 'ERR invalid DB index');
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user