You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Use .end(true) to stricten test cases and improve coverage
This commit is contained in:
@@ -60,7 +60,7 @@ describe("The 'batch' method", function () {
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
client.end(true);
|
||||
});
|
||||
|
||||
it("returns an empty array", function (done) {
|
||||
|
@@ -28,7 +28,7 @@ describe("detect_buffers", function () {
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
client.end(true);
|
||||
});
|
||||
|
||||
describe('get', function () {
|
||||
|
@@ -11,7 +11,7 @@ var client;
|
||||
describe("The 'multi' method", function () {
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
client.end(true);
|
||||
});
|
||||
|
||||
describe('regression test', function () {
|
||||
|
@@ -96,6 +96,30 @@ describe("The node_redis client", function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('safe strings that are bigger than 30000 characters with multi', function(done) {
|
||||
var str = 'foo ಠ_ಠ bar ';
|
||||
while (str.length < 111111) {
|
||||
str += str;
|
||||
}
|
||||
var called = false;
|
||||
var temp = client.writeBuffers.bind(client);
|
||||
assert(String(client.writeBuffers) !== String(client.writeDefault));
|
||||
client.writeBuffers = function (data) {
|
||||
called = true;
|
||||
// To increase write performance for strings the value is converted to a buffer
|
||||
assert(String(client.writeBuffers) === String(client.writeDefault));
|
||||
temp(data);
|
||||
};
|
||||
client.multi().set('foo', str).get('foo', function (err, res) {
|
||||
assert.strictEqual(res, str);
|
||||
}).exec(function (err, res) {
|
||||
assert(called);
|
||||
assert.strictEqual(res[1], str);
|
||||
done();
|
||||
});
|
||||
assert(String(client.writeBuffers) !== String(client.writeDefault));
|
||||
});
|
||||
});
|
||||
|
||||
describe("send_command", function () {
|
||||
@@ -135,7 +159,7 @@ describe("The node_redis client", function () {
|
||||
|
||||
describe(".end", function () {
|
||||
|
||||
it('used without flush', function(done) {
|
||||
it('used without flush / flush set to false', function(done) {
|
||||
var finished = false;
|
||||
var end = helper.callFuncAfter(function() {
|
||||
if (!finished) {
|
||||
@@ -513,7 +537,7 @@ describe("The node_redis client", function () {
|
||||
client.retry_backoff = 1;
|
||||
client.stream.end();
|
||||
} else {
|
||||
client.end();
|
||||
client.end(true);
|
||||
var lasted = new Date().getTime() - time;
|
||||
assert.ok(lasted < 100);
|
||||
return done();
|
||||
|
@@ -367,8 +367,8 @@ describe("publish/subscribe", function () {
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sub.end();
|
||||
pub.end();
|
||||
sub.end(true);
|
||||
pub.end(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -22,7 +22,8 @@ describe("rename commands", function () {
|
||||
rename_commands: {
|
||||
set: '807081f5afa96845a02816a28b7258c3',
|
||||
GETRANGE: '9e3102b15cf231c4e9e940f284744fe0'
|
||||
}
|
||||
},
|
||||
parser: parser
|
||||
});
|
||||
|
||||
client.on('ready', function () {
|
||||
@@ -31,7 +32,7 @@ describe("rename commands", function () {
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
client.end(true);
|
||||
});
|
||||
|
||||
it("allows to use renamed functions", function (done) {
|
||||
|
@@ -277,8 +277,8 @@ describe("return_buffers", function () {
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sub.end();
|
||||
pub.end();
|
||||
sub.end(true);
|
||||
pub.end(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -126,7 +126,7 @@ describe("TLS connection tests", function () {
|
||||
});
|
||||
|
||||
client.on("reconnecting", function (params) {
|
||||
client.end();
|
||||
client.end(true);
|
||||
setTimeout(done, 100);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user