You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Remove async dependency
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
"jshint": "./node_modules/.bin/jshint *"
|
"jshint": "./node_modules/.bin/jshint *"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.3.0",
|
|
||||||
"coveralls": "^2.11.2",
|
"coveralls": "^2.11.2",
|
||||||
"hiredis": "^0.4.1",
|
"hiredis": "^0.4.1",
|
||||||
"jshint": "^2.8.0",
|
"jshint": "^2.8.0",
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var async = require('async');
|
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var config = require("../lib/config");
|
var config = require("../lib/config");
|
||||||
var helper = require('../helper');
|
var helper = require('../helper');
|
||||||
@@ -57,29 +56,16 @@ describe("The 'flushdb' method", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when there is data in Redis", function () {
|
describe("when there is data in Redis", function () {
|
||||||
var oldSize;
|
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
async.parallel([function (next) {
|
var end = helper.callFuncAfter(function () {
|
||||||
client.mset(key, uuid.v4(), key2, uuid.v4(), function (err, res) {
|
client.flushdb(helper.isString("OK", done));
|
||||||
helper.isNotError()(err, res);
|
}, 2);
|
||||||
next(err);
|
client.mset(key, uuid.v4(), key2, uuid.v4(), helper.isNotError(end));
|
||||||
});
|
|
||||||
}, function (next) {
|
|
||||||
client.dbsize([], function (err, res) {
|
client.dbsize([], function (err, res) {
|
||||||
helper.isType.positiveNumber()(err, res);
|
helper.isType.positiveNumber()(err, res);
|
||||||
oldSize = res;
|
assert.equal(res, 2, 'Two keys should have been inserted');
|
||||||
next(err);
|
end();
|
||||||
});
|
|
||||||
}], function (err) {
|
|
||||||
if (err) {
|
|
||||||
return done(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.FLUSHDB(function (err, res) {
|
|
||||||
helper.isString("OK")(err, res);
|
|
||||||
done(err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -116,5 +116,14 @@ module.exports = {
|
|||||||
var mochaListener = process.listeners('uncaughtException').pop();
|
var mochaListener = process.listeners('uncaughtException').pop();
|
||||||
process.removeListener('uncaughtException', mochaListener);
|
process.removeListener('uncaughtException', mochaListener);
|
||||||
return mochaListener;
|
return mochaListener;
|
||||||
|
},
|
||||||
|
callFuncAfter: function (func, max) {
|
||||||
|
var i = 0;
|
||||||
|
return function () {
|
||||||
|
i++;
|
||||||
|
if (i === max) {
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var async = require("async");
|
|
||||||
var assert = require("assert");
|
var assert = require("assert");
|
||||||
var config = require("./lib/config");
|
var config = require("./lib/config");
|
||||||
var helper = require('./helper');
|
var helper = require('./helper');
|
||||||
@@ -122,31 +121,15 @@ describe("The node_redis client", function () {
|
|||||||
it("reconnects and can retrieve the pre-existing data", function (done) {
|
it("reconnects and can retrieve the pre-existing data", function (done) {
|
||||||
client.on("reconnecting", function on_recon(params) {
|
client.on("reconnecting", function on_recon(params) {
|
||||||
client.on("connect", function on_connect() {
|
client.on("connect", function on_connect() {
|
||||||
async.parallel([function (cb) {
|
var end = helper.callFuncAfter(function () {
|
||||||
client.get("recon 1", function (err, res) {
|
|
||||||
helper.isString("one")(err, res);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
}, function (cb) {
|
|
||||||
client.get("recon 1", function (err, res) {
|
|
||||||
helper.isString("one")(err, res);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
}, function (cb) {
|
|
||||||
client.get("recon 2", function (err, res) {
|
|
||||||
helper.isString("two")(err, res);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
}, function (cb) {
|
|
||||||
client.get("recon 2", function (err, res) {
|
|
||||||
helper.isString("two")(err, res);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
}], function (err, results) {
|
|
||||||
client.removeListener("connect", on_connect);
|
client.removeListener("connect", on_connect);
|
||||||
client.removeListener("reconnecting", on_recon);
|
client.removeListener("reconnecting", on_recon);
|
||||||
done(err);
|
done();
|
||||||
});
|
}, 4);
|
||||||
|
client.get("recon 1", helper.isString("one", end));
|
||||||
|
client.get("recon 1", helper.isString("one", end));
|
||||||
|
client.get("recon 2", helper.isString("two", end));
|
||||||
|
client.get("recon 2", helper.isString("two", end));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user