1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Fix should_buffer return values and empty .batch and .auth return value being sync

Fix test
This commit is contained in:
Ruben Bridgewater
2015-10-10 03:30:53 +02:00
parent 7d2bb8edec
commit ed2fc95444
6 changed files with 57 additions and 21 deletions

View File

@@ -32,11 +32,12 @@ describe("The 'multi' method", function () {
});
it("reports an error", function (done) {
client.multi();
client.exec(function (err, res) {
var multi = client.multi();
var notBuffering = multi.exec(function (err, res) {
assert(err.message.match(/The connection has already been closed/));
done();
});
assert.strictEqual(notBuffering, false);
});
it("reports an error if promisified", function () {
@@ -51,7 +52,7 @@ describe("The 'multi' method", function () {
beforeEach(function (done) {
client = redis.createClient.apply(redis.createClient, args);
client.once("connect", function () {
client.once("ready", function () {
client.flushdb(function (err) {
return done(err);
});
@@ -62,6 +63,16 @@ describe("The 'multi' method", function () {
client.end();
});
it("returns an empty result array", function (done) {
var multi = client.multi();
var notBuffering = multi.exec(function (err, res) {
assert.strictEqual(err, null);
assert.strictEqual(res.length, 0);
done();
});
assert.strictEqual(notBuffering, true);
});
it('roles back a transaction when one command in a sequence of commands fails', function (done) {
var multi1, multi2;
var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {};