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

Replace jshint with eslint and add lots of rules

Fix eslint errors accordingly
This commit is contained in:
Ruben Bridgewater
2016-03-26 04:05:43 +01:00
parent 12579e5e8e
commit 94e9f1fcfc
98 changed files with 1621 additions and 1551 deletions

View File

@ -1,16 +1,16 @@
'use strict';
var assert = require('assert');
var config = require("../lib/config");
var config = require('../lib/config');
var helper = require('../helper');
var redis = config.redis;
var uuid = require('uuid');
describe("The 'set' method", function () {
helper.allTests(function(parser, ip, args) {
helper.allTests(function (parser, ip, args) {
describe("using " + parser + " and " + ip, function () {
describe('using ' + parser + ' and ' + ip, function () {
var key, value;
beforeEach(function () {
@ -18,18 +18,18 @@ describe("The 'set' method", function () {
value = uuid.v4();
});
describe("when not connected", function () {
describe('when not connected', function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(null, args);
client.once("ready", function () {
client.once('ready', function () {
client.quit();
});
client.on('end', done);
});
it("reports an error", function (done) {
it('reports an error', function (done) {
client.set(key, value, function (err, res) {
assert(err.message.match(/The connection has already been closed/));
done();
@ -37,12 +37,12 @@ describe("The 'set' method", function () {
});
});
describe("when connected", function () {
describe('when connected', function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(null, args);
client.once("ready", function () {
client.once('ready', function () {
done();
});
});
@ -51,9 +51,9 @@ describe("The 'set' method", function () {
client.end(true);
});
describe("and a callback is specified", function () {
describe("with valid parameters", function () {
it("sets the value correctly", function (done) {
describe('and a callback is specified', function () {
describe('with valid parameters', function () {
it('sets the value correctly', function (done) {
client.SET(key, value, function (err, res) {
helper.isNotError()(err, res);
client.get(key, function (err, res) {
@ -64,7 +64,7 @@ describe("The 'set' method", function () {
});
});
describe("reports an error with invalid parameters", function () {
describe('reports an error with invalid parameters', function () {
it("undefined 'key' and missing 'value' parameter", function (done) {
client.set(undefined, function (err, res) {
helper.isError()(err, null);
@ -73,7 +73,7 @@ describe("The 'set' method", function () {
});
});
it("empty array as second parameter", function (done) {
it('empty array as second parameter', function (done) {
client.set('foo', [], function (err, res) {
assert.strictEqual(err.message, "ERR wrong number of arguments for 'set' command");
done();
@ -82,26 +82,26 @@ describe("The 'set' method", function () {
});
});
describe("and no callback is specified", function () {
describe("with valid parameters", function () {
it("sets the value correctly", function (done) {
describe('and no callback is specified', function () {
describe('with valid parameters', function () {
it('sets the value correctly', function (done) {
client.set(key, value);
client.get(key, helper.isString(value, done));
});
it("sets the value correctly even if the callback is explicitly set to undefined", function (done) {
it('sets the value correctly even if the callback is explicitly set to undefined', function (done) {
client.set(key, value, undefined);
client.get(key, helper.isString(value, done));
});
it("sets the value correctly with the array syntax", function (done) {
it('sets the value correctly with the array syntax', function (done) {
client.set([key, value]);
client.get(key, helper.isString(value, done));
});
});
describe("with undefined 'key' and missing 'value' parameter", function () {
it("emits an error without callback", function (done) {
it('emits an error without callback', function (done) {
client.on('error', function (err) {
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
assert.equal(err.command, 'SET');
@ -117,7 +117,7 @@ describe("The 'set' method", function () {
client.get('foo', helper.isString('null', done));
});
it("emit an error with only the key set", function (done) {
it('emit an error with only the key set', function (done) {
client.on('error', function (err) {
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
done();
@ -126,8 +126,8 @@ describe("The 'set' method", function () {
client.set('foo');
});
it("emit an error without any parameters", function (done) {
client.once("error", function (err) {
it('emit an error without any parameters', function (done) {
client.once('error', function (err) {
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
assert.equal(err.command, 'SET');
done();