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

Add more tests

Add execution order tests
Fix flaky test
Add utils tests
Improve other tests
This commit is contained in:
Ruben Bridgewater
2016-02-25 02:37:42 +01:00
parent 614e35ab57
commit 4f3c4a2ef6
7 changed files with 210 additions and 12 deletions

View File

@@ -423,6 +423,41 @@ describe("The node_redis client", function () {
});
});
describe('execution order / fire query while loading', function () {
it('keep execution order for commands that may fire while redis is still loading', function (done) {
client = redis.createClient.apply(null, args);
var fired = false;
client.set('foo', 'bar', function (err, res) {
assert(fired === false);
done();
});
client.info(function (err, res) {
fired = true;
});
});
it('should fire early', function (done) {
client = redis.createClient.apply(null, args);
var fired = false;
client.info(function (err, res) {
fired = true;
});
client.set('foo', 'bar', function (err, res) {
assert(fired);
done();
});
assert.strictEqual(client.offline_queue.length, 1);
assert.strictEqual(client.command_queue.length, 1);
client.on('connect', function () {
assert.strictEqual(client.offline_queue.length, 1);
assert.strictEqual(client.command_queue.length, 1);
});
client.on('ready', function () {
assert.strictEqual(client.offline_queue.length, 0);
});
});
});
describe('socket_nodelay', function () {
describe('true', function () {
var args = config.configureClient(parser, ip, {