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

the monitor test should not be within the block of tests related to redis closing unexpectedly

This commit is contained in:
bcoe
2015-10-03 21:28:14 -07:00
parent aad5045c8e
commit b773119967

View File

@@ -355,42 +355,41 @@ describe("The node_redis client", function () {
} }
}); });
}); });
});
describe('monitor', function () { describe('monitor', function () {
it('monitors commands on all other redis clients', function (done) { it('monitors commands on all other redis clients', function (done) {
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
var monitorClient = redis.createClient.apply(redis.createClient, args); var monitorClient = redis.createClient.apply(redis.createClient, args);
var responses = []; var responses = [];
monitorClient.monitor(function (err, res) { monitorClient.monitor(function (err, res) {
client.mget("some", "keys", "foo", "bar"); client.mget("some", "keys", "foo", "bar");
client.set("json", JSON.stringify({ client.set("json", JSON.stringify({
foo: "123", foo: "123",
bar: "sdflkdfsjk", bar: "sdflkdfsjk",
another: false another: false
})); }));
}); });
monitorClient.on("monitor", function (time, args) { monitorClient.on("monitor", function (time, args) {
responses.push(args); responses.push(args);
if (responses.length === 2) { if (responses.length === 2) {
assert.strictEqual(5, responses[0].length); assert.strictEqual(5, responses[0].length);
assert.strictEqual("mget", responses[0][0]); assert.strictEqual("mget", responses[0][0]);
assert.strictEqual("some", responses[0][1]); assert.strictEqual("some", responses[0][1]);
assert.strictEqual("keys", responses[0][2]); assert.strictEqual("keys", responses[0][2]);
assert.strictEqual("foo", responses[0][3]); assert.strictEqual("foo", responses[0][3]);
assert.strictEqual("bar", responses[0][4]); assert.strictEqual("bar", responses[0][4]);
assert.strictEqual(3, responses[1].length); assert.strictEqual(3, responses[1].length);
assert.strictEqual("set", responses[1][0]); assert.strictEqual("set", responses[1][0]);
assert.strictEqual("json", responses[1][1]); assert.strictEqual("json", responses[1][1]);
assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]); assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]);
monitorClient.quit(done); monitorClient.quit(done);
} }
});
}); });
}); });
}); });
describe('idle', function () { describe('idle', function () {