Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

catbox-redis

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

catbox-redis - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

28

examples/redis.js

@@ -1,4 +0,1 @@

'use strict';
// After starting this example load http://localhost:8080 and hit refresh, you will notice that it loads the response from cache for the first 5 seconds and then reloads the cache

@@ -8,4 +5,4 @@

const Catbox = require('catbox');
const Http = require('http');
var Catbox = require('catbox');
var Http = require('http');

@@ -16,3 +13,3 @@

const internals = {};
var internals = {};

@@ -22,3 +19,3 @@

internals.getResponse((err, item) => {
internals.getResponse(function (err, item) {

@@ -39,3 +36,3 @@ if (err) {

const key = {
var key = {
segment: 'example',

@@ -45,6 +42,6 @@ id: 'myExample'

const cacheValue = 'my example';
const ttl = 10000; // How long item will be cached in milliseconds
var cacheValue = 'my example';
var ttl = 10000; // How long item will be cached in milliseconds
internals.client.get(key, (err, cached) => {
internals.client.get(key, function (err, cached) {

@@ -57,3 +54,3 @@ if (err) {

}
internals.client.set(key, cacheValue, ttl, (error) => {
internals.client.set(key, cacheValue, ttl, function (error) {

@@ -68,3 +65,3 @@ callback(error, cacheValue);

const options = {
var options = {
partition: 'examples', // For redis this will store items under keys that start with examples:

@@ -87,5 +84,4 @@ host: '127.0.0.1', // If you don't supply, 127.0.0.1 is the default

process.exit();
}
else {
const server = Http.createServer(internals.handler);
} else {
var server = Http.createServer(internals.handler);
server.listen(8080);

@@ -92,0 +88,0 @@ console.log('Server started at http://localhost:8080/');

@@ -6,4 +6,4 @@

const Redis = require('redis');
const Hoek = require('hoek');
var Redis = require('redis');
var Hoek = require('hoek');

@@ -13,3 +13,3 @@

const internals = {};
var internals = {};

@@ -37,3 +37,3 @@

const self = this;
var self = this;
if (this.client) {

@@ -43,3 +43,3 @@ return Hoek.nextTick(callback)();

let client;
var client;

@@ -63,3 +63,3 @@ if (this.settings.socket) {

client.on('error', (err) => {
client.on('error', function (err) {

@@ -74,3 +74,3 @@ if (!self.client) { // Failed to connect

client.once('ready', () => {
client.once('ready', function () {

@@ -119,3 +119,3 @@ self.client = client;

this.client.get(this.generateKey(key), (err, result) => {
this.client.get(this.generateKey(key), function (err, result) {

@@ -130,3 +130,3 @@ if (err) {

let envelope = null;
var envelope = null;
try {

@@ -154,3 +154,3 @@ envelope = JSON.parse(result);

const self = this;
var self = this;

@@ -161,3 +161,3 @@ if (!this.client) {

const envelope = {
var envelope = {
item: value,

@@ -168,5 +168,5 @@ stored: Date.now(),

const cacheKey = this.generateKey(key);
var cacheKey = this.generateKey(key);
let stringifiedEnvelope = null;
var stringifiedEnvelope = null;

@@ -180,3 +180,3 @@ try {

this.client.set(cacheKey, stringifiedEnvelope, (err) => {
this.client.set(cacheKey, stringifiedEnvelope, function (err) {

@@ -187,4 +187,4 @@ if (err) {

const ttlSec = Math.max(1, Math.floor(ttl / 1000));
self.client.expire(cacheKey, ttlSec, (err) => { // Use 'pexpire' with ttl in Redis 2.6.0
var ttlSec = Math.max(1, Math.floor(ttl / 1000));
self.client.expire(cacheKey, ttlSec, function (err) { // Use 'pexpire' with ttl in Redis 2.6.0

@@ -203,3 +203,3 @@ return callback(err);

this.client.del(this.generateKey(key), (err) => {
this.client.del(this.generateKey(key), function (err) {

@@ -206,0 +206,0 @@ return callback(err);

{
"name": "catbox-redis",
"description": "Redis adapter for catbox",
"version": "1.0.9",
"version": "1.0.10",
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)",

@@ -21,8 +21,8 @@ "contributors": [

"redis": "2.x.x",
"hoek": "3.x.x"
"hoek": "2.x.x"
},
"devDependencies": {
"catbox": "7.x.x",
"code": "2.x.x",
"lab": "10.x.x"
"catbox": "4.x.x",
"code": "1.x.x",
"lab": "6.x.x"
},

@@ -29,0 +29,0 @@ "scripts": {

@@ -6,7 +6,7 @@

const Code = require('code');
const Lab = require('lab');
const Catbox = require('catbox');
const Redis = require('..');
const RedisClient = require('redis');
var Code = require('code');
var Lab = require('lab');
var Catbox = require('catbox');
var Redis = require('..');
var RedisClient = require('redis');

@@ -16,3 +16,3 @@

const internals = {};
var internals = {};

@@ -22,13 +22,13 @@

const lab = exports.lab = Lab.script();
const expect = Code.expect;
const describe = lab.describe;
const it = lab.test;
var lab = exports.lab = Lab.script();
var expect = Code.expect;
var describe = lab.describe;
var it = lab.test;
describe('Redis', () => {
describe('Redis', function () {
it('throws an error if not created with new', (done) => {
it('throws an error if not created with new', function (done) {
const fn = () => {
var fn = function () {

@@ -42,6 +42,6 @@ Redis();

it('creates a new connection', (done) => {
it('creates a new connection', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {

@@ -53,6 +53,6 @@ expect(client.isReady()).to.equal(true);

it('closes the connection', (done) => {
it('closes the connection', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {

@@ -67,8 +67,8 @@ expect(err).to.not.exist();

it('allow passing client in option', (done) => {
it('allow passing client in option', function (done) {
const redisClient = RedisClient.createClient();
var redisClient = RedisClient.createClient();
let getCalled = false;
const _get = redisClient.get;
var getCalled = false;
var _get = redisClient.get;
redisClient.get = function (key, callback) {

@@ -81,13 +81,13 @@

redisClient.on('error', done);
redisClient.once('ready', () => {
redisClient.once('ready', function () {
const client = new Catbox.Client(Redis, {
var client = new Catbox.Client(Redis, {
client: redisClient
});
client.start((err) => {
client.start(function (err) {
expect(err).to.not.exist();
expect(client.isReady()).to.equal(true);
const key = { id: 'x', segment: 'test' };
client.get(key, (err, result) => {
var key = { id: 'x', segment: 'test' };
client.get(key, function (err, result) {

@@ -102,13 +102,13 @@ expect(err).to.equal(null);

it('gets an item after settig it', (done) => {
it('gets an item after settig it', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
const key = { id: 'x', segment: 'test' };
client.set(key, '123', 500, (err) => {
var key = { id: 'x', segment: 'test' };
client.set(key, '123', 500, function (err) {
expect(err).to.not.exist();
client.get(key, (err, result) => {
client.get(key, function (err, result) {

@@ -123,12 +123,12 @@ expect(err).to.equal(null);

it('fails setting an item circular references', (done) => {
it('fails setting an item circular references', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
const key = { id: 'x', segment: 'test' };
const value = { a: 1 };
var key = { id: 'x', segment: 'test' };
var value = { a: 1 };
value.b = value;
client.set(key, value, 10, (err) => {
client.set(key, value, 10, function (err) {

@@ -141,9 +141,9 @@ expect(err.message).to.equal('Converting circular structure to JSON');

it('ignored starting a connection twice on same event', (done) => {
it('ignored starting a connection twice on same event', function (done) {
const client = new Catbox.Client(Redis);
let x = 2;
const start = () => {
var client = new Catbox.Client(Redis);
var x = 2;
var start = function () {
client.start((err) => {
client.start(function (err) {

@@ -163,6 +163,6 @@ expect(err).to.not.exist();

it('ignored starting a connection twice chained', (done) => {
it('ignored starting a connection twice chained', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {

@@ -172,3 +172,3 @@ expect(err).to.not.exist();

client.start((err) => {
client.start(function (err) {

@@ -182,9 +182,9 @@ expect(err).to.not.exist();

it('returns not found on get when using null key', (done) => {
it('returns not found on get when using null key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.get(null, (err, result) => {
client.get(null, function (err, result) {

@@ -198,15 +198,15 @@ expect(err).to.equal(null);

it('returns not found on get when item expired', (done) => {
it('returns not found on get when item expired', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
const key = { id: 'x', segment: 'test' };
client.set(key, 'x', 1, (err) => {
var key = { id: 'x', segment: 'test' };
client.set(key, 'x', 1, function (err) {
expect(err).to.not.exist();
setTimeout(() => {
setTimeout(function () {
client.get(key, (err, result) => {
client.get(key, function (err, result) {

@@ -222,9 +222,9 @@ expect(err).to.equal(null);

it('returns error on set when using null key', (done) => {
it('returns error on set when using null key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.set(null, {}, 1000, (err) => {
client.set(null, {}, 1000, function (err) {

@@ -237,9 +237,9 @@ expect(err instanceof Error).to.equal(true);

it('returns error on get when using invalid key', (done) => {
it('returns error on get when using invalid key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.get({}, (err) => {
client.get({}, function (err) {

@@ -252,9 +252,9 @@ expect(err instanceof Error).to.equal(true);

it('returns error on drop when using invalid key', (done) => {
it('returns error on drop when using invalid key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.drop({}, (err) => {
client.drop({}, function (err) {

@@ -267,9 +267,9 @@ expect(err instanceof Error).to.equal(true);

it('returns error on set when using invalid key', (done) => {
it('returns error on set when using invalid key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.set({}, {}, 1000, (err) => {
client.set({}, {}, 1000, function (err) {

@@ -282,10 +282,10 @@ expect(err instanceof Error).to.equal(true);

it('ignores set when using non-positive ttl value', (done) => {
it('ignores set when using non-positive ttl value', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
const key = { id: 'x', segment: 'test' };
client.set(key, 'y', 0, (err) => {
var key = { id: 'x', segment: 'test' };
client.set(key, 'y', 0, function (err) {

@@ -298,9 +298,9 @@ expect(err).to.not.exist();

it('returns error on drop when using null key', (done) => {
it('returns error on drop when using null key', function (done) {
const client = new Catbox.Client(Redis);
client.start((err) => {
var client = new Catbox.Client(Redis);
client.start(function (err) {
expect(err).to.not.exist();
client.drop(null, (err) => {
client.drop(null, function (err) {

@@ -313,8 +313,8 @@ expect(err instanceof Error).to.equal(true);

it('returns error on get when stopped', (done) => {
it('returns error on get when stopped', function (done) {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
client.stop();
const key = { id: 'x', segment: 'test' };
client.connection.get(key, (err, result) => {
var key = { id: 'x', segment: 'test' };
client.connection.get(key, function (err, result) {

@@ -327,8 +327,8 @@ expect(err).to.exist();

it('returns error on set when stopped', (done) => {
it('returns error on set when stopped', function (done) {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
client.stop();
const key = { id: 'x', segment: 'test' };
client.connection.set(key, 'y', 1, (err) => {
var key = { id: 'x', segment: 'test' };
client.connection.set(key, 'y', 1, function (err) {

@@ -340,8 +340,8 @@ expect(err).to.exist();

it('returns error on drop when stopped', (done) => {
it('returns error on drop when stopped', function (done) {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
client.stop();
const key = { id: 'x', segment: 'test' };
client.connection.drop(key, (err) => {
var key = { id: 'x', segment: 'test' };
client.connection.drop(key, function (err) {

@@ -353,10 +353,10 @@ expect(err).to.exist();

it('returns error on missing segment name', (done) => {
it('returns error on missing segment name', function (done) {
const config = {
var config = {
expiresIn: 50000
};
const fn = () => {
var fn = function () {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
new Catbox.Policy(config, client, '');

@@ -368,10 +368,10 @@ };

it('returns error on bad segment name', (done) => {
it('returns error on bad segment name', function (done) {
const config = {
var config = {
expiresIn: 50000
};
const fn = () => {
var fn = function () {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
new Catbox.Policy(config, client, 'a\0b');

@@ -383,7 +383,7 @@ };

it('returns error when cache item dropped while stopped', (done) => {
it('returns error when cache item dropped while stopped', function (done) {
const client = new Catbox.Client(Redis);
var client = new Catbox.Client(Redis);
client.stop();
client.drop('a', (err) => {
client.drop('a', function (err) {

@@ -395,7 +395,7 @@ expect(err).to.exist();

describe('start()', () => {
describe('start()', function () {
it('sets client to when the connection succeeds', (done) => {
it('sets client to when the connection succeeds', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -405,5 +405,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -416,5 +416,5 @@ expect(err).to.not.exist();

it('reuses the client when a connection is already started', (done) => {
it('reuses the client when a connection is already started', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -424,10 +424,10 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {
expect(err).to.not.exist();
const client = redis.client;
var client = redis.client;
redis.start(() => {
redis.start(function () {

@@ -440,5 +440,5 @@ expect(client).to.equal(redis.client);

it('returns an error when connection fails', (done) => {
it('returns an error when connection fails', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -448,5 +448,5 @@ port: 6380

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -460,5 +460,5 @@ expect(err).to.exist();

it('sends auth command when password is provided', (done) => {
it('sends auth command when password is provided', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -469,5 +469,5 @@ port: 6379,

const redis = new Redis(options);
var redis = new Redis(options);
const log = console.log;
var log = console.log;
console.log = function (message) {

@@ -479,3 +479,3 @@

redis.start((err) => {
redis.start(function (err) {

@@ -487,5 +487,5 @@ expect(err).to.not.exist();

it('fails in error when auth is not correct', (done) => {
it('fails in error when auth is not correct', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -496,5 +496,5 @@ port: 6378,

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -508,5 +508,5 @@ expect(err).to.exist();

it('success when auth is correct', (done) => {
it('success when auth is correct', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -517,3 +517,3 @@ port: 6378,

const redis = new Redis(options);
var redis = new Redis(options);

@@ -523,5 +523,5 @@ redis.start(done);

it('sends select command when database is provided', (done) => {
it('sends select command when database is provided', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -532,8 +532,8 @@ port: 6379,

const redis = new Redis(options);
var redis = new Redis(options);
redis.start(() => {});
redis.start(function () {});
// redis.client.selected_db gets updated after the callback
setTimeout(() => {
setTimeout(function () {

@@ -545,14 +545,14 @@ expect(redis.client.selected_db).to.equal(1);

it('connects to a unix domain socket when one is provided.', (done) => {
it('connects to a unix domain socket when one is provided.', function (done) {
const options = {
var options = {
socket: '/tmp/redis.sock'
};
const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {
expect(err).to.not.exist();
const client = redis.client;
var client = redis.client;
expect(client).to.exist();

@@ -565,5 +565,5 @@ expect(client.connected).to.equal(true);

it('does not stops the client on error post connection', (done) => {
it('does not stops the client on error post connection', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -573,5 +573,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -588,7 +588,7 @@ expect(err).to.not.exist();

describe('isReady()', () => {
describe('isReady()', function () {
it('returns true when when connected', (done) => {
it('returns true when when connected', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -598,5 +598,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -612,5 +612,5 @@ expect(err).to.not.exist();

it('returns false when stopped', (done) => {
it('returns false when stopped', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -620,5 +620,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -636,5 +636,5 @@ expect(err).to.not.exist();

it('returns false when disconnected', (done) => {
it('returns false when disconnected', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -644,5 +644,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start((err) => {
redis.start(function (err) {

@@ -662,7 +662,7 @@ expect(err).to.not.exist();

describe('validateSegmentName()', () => {
describe('validateSegmentName()', function () {
it('returns an error when the name is empty', (done) => {
it('returns an error when the name is empty', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -672,5 +672,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
const result = redis.validateSegmentName('');
var result = redis.validateSegmentName('');

@@ -682,5 +682,5 @@ expect(result).to.be.instanceOf(Error);

it('returns an error when the name has a null character', (done) => {
it('returns an error when the name has a null character', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -690,5 +690,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
const result = redis.validateSegmentName('\0test');
var result = redis.validateSegmentName('\0test');

@@ -699,5 +699,5 @@ expect(result).to.be.instanceOf(Error);

it('returns null when there aren\'t any errors', (done) => {
it('returns null when there aren\'t any errors', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -707,5 +707,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
const result = redis.validateSegmentName('valid');
var result = redis.validateSegmentName('valid');

@@ -718,7 +718,7 @@ expect(result).to.not.be.instanceOf(Error);

describe('get()', () => {
describe('get()', function () {
it('passes an error to the callback when the connection is closed', (done) => {
it('passes an error to the callback when the connection is closed', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -728,5 +728,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.get('test', (err) => {
redis.get('test', function (err) {

@@ -740,5 +740,5 @@ expect(err).to.exist();

it('passes an error to the callback when there is an error returned from getting an item', (done) => {
it('passes an error to the callback when there is an error returned from getting an item', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -748,3 +748,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -757,3 +757,3 @@ get: function (item, callback) {

redis.get('test', (err) => {
redis.get('test', function (err) {

@@ -766,5 +766,5 @@ expect(err).to.exist();

it('passes an error to the callback when there is an error parsing the result', (done) => {
it('passes an error to the callback when there is an error parsing the result', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -774,3 +774,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -783,3 +783,3 @@ get: function (item, callback) {

redis.get('test', (err) => {
redis.get('test', function (err) {

@@ -792,5 +792,5 @@ expect(err).to.exist();

it('passes an error to the callback when there is an error with the envelope structure (stored)', (done) => {
it('passes an error to the callback when there is an error with the envelope structure (stored)', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -800,3 +800,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -809,3 +809,3 @@ get: function (item, callback) {

redis.get('test', (err) => {
redis.get('test', function (err) {

@@ -818,5 +818,5 @@ expect(err).to.exist();

it('passes an error to the callback when there is an error with the envelope structure (item)', (done) => {
it('passes an error to the callback when there is an error with the envelope structure (item)', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -826,3 +826,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -835,3 +835,3 @@ get: function (item, callback) {

redis.get('test', (err) => {
redis.get('test', function (err) {

@@ -844,5 +844,5 @@ expect(err).to.exist();

it('is able to retrieve an object thats stored when connection is started', (done) => {
it('is able to retrieve an object thats stored when connection is started', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -852,3 +852,3 @@ port: 6379,

};
const key = {
var key = {
id: 'test',

@@ -858,10 +858,10 @@ segment: 'test'

const redis = new Redis(options);
var redis = new Redis(options);
redis.start(() => {
redis.start(function () {
redis.set(key, 'myvalue', 200, (err) => {
redis.set(key, 'myvalue', 200, function (err) {
expect(err).to.not.exist();
redis.get(key, (err, result) => {
redis.get(key, function (err, result) {

@@ -876,5 +876,5 @@ expect(err).to.not.exist();

it('returns null when unable to find the item', (done) => {
it('returns null when unable to find the item', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -884,3 +884,3 @@ port: 6379,

};
const key = {
var key = {
id: 'notfound',

@@ -890,7 +890,7 @@ segment: 'notfound'

const redis = new Redis(options);
var redis = new Redis(options);
redis.start(() => {
redis.start(function () {
redis.get(key, (err, result) => {
redis.get(key, function (err, result) {

@@ -905,7 +905,7 @@ expect(err).to.not.exist();

describe('set()', () => {
describe('set()', function () {
it('passes an error to the callback when the connection is closed', (done) => {
it('passes an error to the callback when the connection is closed', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -915,5 +915,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.set('test1', 'test1', 3600, (err) => {
redis.set('test1', 'test1', 3600, function (err) {

@@ -927,5 +927,5 @@ expect(err).to.exist();

it('passes an error to the callback when there is an error returned from setting an item', (done) => {
it('passes an error to the callback when there is an error returned from setting an item', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -935,3 +935,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -944,3 +944,3 @@ set: function (key, item, callback) {

redis.set('test', 'test', 3600, (err) => {
redis.set('test', 'test', 3600, function (err) {

@@ -954,7 +954,7 @@ expect(err).to.exist();

describe('drop()', () => {
describe('drop()', function () {
it('passes an error to the callback when the connection is closed', (done) => {
it('passes an error to the callback when the connection is closed', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -964,5 +964,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.drop('test2', (err) => {
redis.drop('test2', function (err) {

@@ -976,5 +976,5 @@ expect(err).to.exist();

it('deletes the item from redis', (done) => {
it('deletes the item from redis', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -984,3 +984,3 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.client = {

@@ -993,3 +993,3 @@ del: function (key, callback) {

redis.drop('test', (err) => {
redis.drop('test', function (err) {

@@ -1002,7 +1002,7 @@ expect(err).to.not.exist();

describe('stop()', () => {
describe('stop()', function () {
it('sets the client to null', (done) => {
it('sets the client to null', function (done) {
const options = {
var options = {
host: '127.0.0.1',

@@ -1012,5 +1012,5 @@ port: 6379

const redis = new Redis(options);
var redis = new Redis(options);
redis.start(() => {
redis.start(function () {

@@ -1017,0 +1017,0 @@ expect(redis.client).to.exist();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc