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

Insert deprecation warnings and some minor refactoring

This commit is contained in:
Ruben Bridgewater
2016-03-01 17:11:02 +01:00
parent 19ea518b36
commit 575ad7357b
9 changed files with 140 additions and 46 deletions

View File

@@ -4,6 +4,7 @@ var assert = require("assert");
var config = require("../lib/config");
var helper = require("../helper");
var redis = config.redis;
var intercept = require('intercept-stdout');
describe("The 'blpop' method", function () {
@@ -23,7 +24,14 @@ describe("The 'blpop' method", function () {
it('pops value immediately if list contains values', function (done) {
bclient = redis.createClient.apply(redis.createClient, args);
redis.debug_mode = true;
var text = '';
var unhookIntercept = intercept(function(data) {
text += data;
return '';
});
client.rpush("blocking list", "initial value", helper.isNumber(1));
unhookIntercept();
assert(/^Send 127\.0\.0\.1:6379 id [0-9]+: \*3\r\n\$5\r\nrpush\r\n\$13\r\nblocking list\r\n\$13\r\ninitial value\r\n\n$/.test(text));
redis.debug_mode = false;
bclient.blpop("blocking list", 0, function (err, value) {
assert.strictEqual(value[0], "blocking list");

View File

@@ -68,7 +68,6 @@ describe("The 'get' method", function () {
});
it("gets the value correctly", function (done) {
client.GET(key, redis.print); // Use the utility function to print the result
client.GET(key, function (err, res) {
helper.isString(value)(err, res);
done(err);

View File

@@ -33,7 +33,6 @@ describe("The 'getset' method", function () {
});
it("reports an error", function (done) {
client.GET(key, redis.print); // Use the utility function to print the error
client.get(key, function (err, res) {
assert(err.message.match(/The connection has already been closed/));
done();