1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Improve pipeline logic and fix #897

This commit is contained in:
Ruben Bridgewater
2015-10-26 21:35:19 +01:00
parent 1cb158b5da
commit 399a29a97c
3 changed files with 77 additions and 88 deletions

View File

@@ -162,7 +162,7 @@ describe("The 'batch' method", function () {
});
});
it('handles batchple operations being applied to a set', function (done) {
it('handles multiple operations being applied to a set', function (done) {
client.sadd("some set", "mem 1");
client.sadd(["some set", "mem 2"]);
client.sadd("some set", "mem 3");
@@ -189,7 +189,7 @@ describe("The 'batch' method", function () {
});
});
it('allows batchple operations to be performed using constructor with all kinds of syntax', function (done) {
it('allows multiple operations to be performed using constructor with all kinds of syntax', function (done) {
var now = Date.now();
var arr = ["batchhmset", "batchbar", "batchbaz"];
var arr2 = ['some manner of key', 'otherTypes'];
@@ -253,7 +253,7 @@ describe("The 'batch' method", function () {
assert.strictEqual(buffering, true);
});
it('allows batchple operations to be performed using a chaining API', function (done) {
it('allows multiple operations to be performed using a chaining API', function (done) {
client.batch()
.mset('some', '10', 'keys', '20')
.incr('some')
@@ -270,7 +270,7 @@ describe("The 'batch' method", function () {
});
});
it('allows batchple commands to work the same as normal to be performed using a chaining API', function (done) {
it('allows multiple commands to work the same as normal to be performed using a chaining API', function (done) {
client.batch()
.mset(['some', '10', 'keys', '20'])
.incr(['some', helper.isNumber(11)])
@@ -287,7 +287,7 @@ describe("The 'batch' method", function () {
});
});
it('allows batchple commands to work the same as normal to be performed using a chaining API promisified', function () {
it('allows multiple commands to work the same as normal to be performed using a chaining API promisified', function () {
return client.batch()
.mset(['some', '10', 'keys', '20'])
.incr(['some', helper.isNumber(11)])
@@ -303,7 +303,7 @@ describe("The 'batch' method", function () {
});
});
it('allows an array to be provided indicating batchple operations to perform', function (done) {
it('allows an array to be provided indicating multiple operations to perform', function (done) {
// test nested batch-bulk replies with nulls.
client.batch([
["mget", ["batchfoo", "some", "random value", "keys"]],

View File

@@ -43,6 +43,22 @@ describe("The node_redis client", function () {
});
});
describe('big data', function () {
// Check if the fast mode for big strings is working correct
it('safe strings that are bigger than 30000 characters', function(done) {
var str = 'foo ಠ_ಠ bar ';
while (str.length < 111111) {
str += str;
}
client.set('foo', str);
client.get('foo', function (err, res) {
assert.strictEqual(res, str);
done();
});
});
});
describe("send_command", function () {
it("omitting args should be fine in some cases", function (done) {
@@ -470,20 +486,6 @@ describe("The node_redis client", function () {
describe('enable_offline_queue', function () {
describe('true', function () {
it("should emit drain after info command and nothing to buffer", function (done) {
client = redis.createClient({
parser: parser
});
client.set('foo', 'bar');
client.get('foo', function () {
assert(!client.should_buffer);
setTimeout(done, 25);
});
client.on('drain', function() {
assert(client.offline_queue.length === 2);
});
});
it("should emit drain if offline queue is flushed and nothing to buffer", function (done) {
client = redis.createClient({
parser: parser,