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

based on code-review added back check for error

This commit is contained in:
Benjamin Coe
2015-09-13 19:17:52 -07:00
parent bb1ab1498b
commit 68936c5eb2

View File

@@ -60,11 +60,13 @@ describe("The 'multi' method", function () {
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 () {};
// Provoke an error at queue time
multi1 = client.MULTI();
multi1.mset("multifoo", "10", "multibar", "20", helper.isString("OK"));
multi1.set("foo2");
multi1.set("foo2", expected);
multi1.incr("multifoo");
multi1.incr("multibar");
multi1.exec(function () {
@@ -90,6 +92,8 @@ describe("The 'multi' method", function () {
});
it('roles back a transaction when one command in an array of commands fails', function (done) {
var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {};
// test nested multi-bulk replies
client.multi([
["mget", "multifoo", "multibar", function (err, res) {
@@ -97,7 +101,7 @@ describe("The 'multi' method", function () {
assert.strictEqual(0, +res[0]);
assert.strictEqual(0, +res[1]);
}],
["set", "foo2"],
["set", "foo2", expected],
["incr", "multifoo"],
["incr", "multibar"]
]).exec(function (err, replies) {