Browse Source

Add some more tests

greenkeeper-update-all
Ruben Bridgewater 9 years ago
parent
commit
2293f7ff85
  1. 1
      index.js
  2. 1
      test/commands/eval.spec.js
  3. 1
      test/commands/multi.spec.js
  4. 4
      test/commands/select.spec.js

1
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);

1
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();
});

1
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();

4
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();
});

Loading…
Cancel
Save