Skip to content

Commit b717c81

Browse files
author
Benjamin Coe
committed
added windows badge, made changes based on @Bridear's code-review
1 parent 224aff9 commit b717c81

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ redis - a node.js redis client
33

44
[![Build Status](https://travis-ci.org/NodeRedis/node_redis.png)](https://travis-ci.org/NodeRedis/node_redis)
55
[![Coverage Status](https://coveralls.io/repos/NodeRedis/node_redis/badge.svg?branch=)](https://coveralls.io/r/NodeRedis/node_redis?branch=)
6+
[![Windows Tests][https://img.shields.io/appveyor/ci/bcoe/node-redis/master.svg?label=Windows%20Tests]][https://ci.appveyor.com/project/bcoe/node-redis]
67

78
This is a complete Redis client for node.js. It supports all Redis commands,
89
including many recently added commands.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"license": "MIT",
1111
"main": "./index.js",
1212
"scripts": {
13-
"coverage": "nyc report --reporter=text-lcov | coveralls",
13+
"coveralls": "nyc report --reporter=text-lcov | coveralls",
14+
"coverage": "nyc report --reporter=html",
1415
"test": "nyc ./node_modules/.bin/_mocha ./test/*.js ./test/commands/*.js ./test/parser/*.js --timeout=8000",
1516
"pretest": "optional-dev-dependency hiredis",
1617
"posttest": "jshint ."

test/commands/eval.spec.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,37 @@ describe("The 'eval' method", function () {
2626
});
2727

2828
it('converts a float to an integer when evaluated', function (done) {
29-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
29+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
3030
client.eval("return 100.5", 0, helper.isNumber(100, done));
3131
});
3232

3333
it('returns a string', function (done) {
34-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
34+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
3535
client.eval("return 'hello world'", 0, helper.isString('hello world', done));
3636
});
3737

3838
it('converts boolean true to integer 1', function (done) {
39-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
39+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
4040
client.eval("return true", 0, helper.isNumber(1, done));
4141
});
4242

4343
it('converts boolean false to null', function (done) {
44-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
44+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
4545
client.eval("return false", 0, helper.isNull(done));
4646
});
4747

4848
it('converts lua status code to string representation', function (done) {
49-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
49+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
5050
client.eval("return {ok='fine'}", 0, helper.isString('fine', done));
5151
});
5252

5353
it('converts lua error to an error response', function (done) {
54-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
54+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
5555
client.eval("return {err='this is an error'}", 0, helper.isError(done));
5656
});
5757

5858
it('represents a lua table appropritely', function (done) {
59-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
59+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
6060
client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) {
6161
assert.strictEqual(5, res.length);
6262
assert.strictEqual(1, res[0]);
@@ -71,7 +71,7 @@ describe("The 'eval' method", function () {
7171
});
7272

7373
it('populates keys and argv correctly', function (done) {
74-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
74+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
7575
client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) {
7676
assert.strictEqual(4, res.length);
7777
assert.strictEqual("a", res[0]);
@@ -83,7 +83,7 @@ describe("The 'eval' method", function () {
8383
});
8484

8585
it('allows arguments to be provided in array rather than as multiple parameters', function (done) {
86-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
86+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
8787
client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) {
8888
assert.strictEqual(4, res.length);
8989
assert.strictEqual("a", res[0]);
@@ -105,23 +105,23 @@ describe("The 'eval' method", function () {
105105
});
106106

107107
it('allows a script to be executed that accesses the redis API', function (done) {
108-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
108+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
109109
client.eval(source, 0, helper.isString('eval get sha test', done));
110110
});
111111

112112
it('can execute a script if the SHA exists', function (done) {
113-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
113+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
114114
client.evalsha(sha, 0, helper.isString('eval get sha test', done));
115115
});
116116

117117
it('throws an error if SHA does not exist', function (done) {
118-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
118+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
119119
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0, helper.isError(done));
120120
});
121121
});
122122

123123
it('allows a key to be incremented, and performs appropriate conversion from LUA type', function (done) {
124-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
124+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
125125
client.set("incr key", 0, function (err, reply) {
126126
if (err) return done(err);
127127
client.eval("local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}", 0, function (err, res) {
@@ -134,7 +134,7 @@ describe("The 'eval' method", function () {
134134
});
135135

136136
it('allows a bulk operation to be performed, and performs appropriate conversion from LUA type', function (done) {
137-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
137+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
138138
client.set("bulk reply key", "bulk reply value", function (err, res) {
139139
client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) {
140140
assert.strictEqual(2, res.length);
@@ -146,7 +146,7 @@ describe("The 'eval' method", function () {
146146
});
147147

148148
it('allows a multi mulk operation to be performed, with the appropriate type conversion', function (done) {
149-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
149+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
150150
client.multi()
151151
.del("mylist")
152152
.rpush("mylist", "a")
@@ -167,7 +167,7 @@ describe("The 'eval' method", function () {
167167
});
168168

169169
it('returns an appropriate representation of Lua status reply', function (done) {
170-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
170+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
171171
client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) {
172172
assert.strictEqual(2, res.length);
173173
assert.strictEqual("table", res[0]);
@@ -177,7 +177,7 @@ describe("The 'eval' method", function () {
177177
});
178178

179179
it('returns an appropriate representation of a Lua error reply', function (done) {
180-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
180+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
181181
client.set("error reply key", "error reply value", function (err, res) {
182182
if (err) return done(err);
183183
client.eval("local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}", 0, function (err, res) {
@@ -190,7 +190,7 @@ describe("The 'eval' method", function () {
190190
});
191191

192192
it('returns an appropriate representation of a Lua nil reply', function (done) {
193-
helper.serverVersionAtLeast.bind(this)(client, [2, 5, 0]);
193+
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
194194
client.del("nil reply key", function (err, res) {
195195
if (err) return done(err);
196196
client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) {

test/commands/multi.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ describe("The 'multi' method", function () {
195195
});
196196

197197
it('reports multiple exceptions when they occur', function (done) {
198-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 5]);
198+
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
199199

200200
client.multi().set("foo").exec(function (err, reply) {
201201
assert(Array.isArray(err), "err should be an array");

test/commands/script.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ describe("The 'script' method", function () {
2828
});
2929

3030
it("loads script with client.script('load')", function (done) {
31-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 0]);
31+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
3232
client.script("load", command, function(err, result) {
3333
assert.strictEqual(result, commandSha);
3434
return done();
3535
});
3636
});
3737

3838
it('allows a loaded script to be evaluated', function (done) {
39-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 0]);
39+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
4040
client.evalsha(commandSha, 0, helper.isString('99', done));
4141
});
4242

4343
it('allows a script to be loaded as part of a chained transaction', function (done) {
44-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 0]);
44+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
4545
client.multi().script("load", command).exec(function(err, result) {
4646
assert.strictEqual(result[0], commandSha);
4747
return done();
4848
});
4949
});
5050

5151
it("allows a script to be loaded using a transaction's array syntax", function (done) {
52-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 0]);
52+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
5353
client.multi([['script', 'load', command]]).exec(function(err, result) {
5454
assert.strictEqual(result[0], commandSha);
5555
return done();

test/node_redis.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ describe("The node_redis client", function () {
219219

220220
describe('monitor', function () {
221221
it('monitors commands on all other redis clients', function (done) {
222-
helper.serverVersionAtLeast.bind(this)(client, [2, 6, 0]);
222+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
223223

224224
var monitorClient = redis.createClient.apply(redis.createClient, args);
225225
var responses = [];

0 commit comments

Comments
 (0)