Socket
Socket
Sign inDemoInstall

machinepack-redis

Package Overview
Dependencies
14
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "machinepack-redis",
"version": "2.0.1",
"version": "2.0.2",
"description": "Structured Node.js bindings for Redis.",

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

@@ -15,3 +15,3 @@ /**

describe('cacheValue()', function (){
describe('cacheValue()', () => {

@@ -32,4 +32,4 @@ // Used to hold manager and active connection throughout the tests below.

//
describe('with no connection', function (){
it('should fail', function (done){
describe('with no connection', () => {
it('should fail', (done) => {
Pack.cacheValue({

@@ -55,3 +55,3 @@ connection: {},

// ╚═╝╩ ╩╚═╝╩╚═╝ ╚═╝╚═╝╩ ╩╚═╝╚═╝
describe('with basic usage', function (){
describe('with basic usage', () => {

@@ -65,3 +65,3 @@

// connection from it.
before(function (done){
before((done) => {
Pack.createManager({

@@ -96,3 +96,3 @@ connectionString: 'redis://127.0.0.1:6379',

it('should work', function (done){
it('should work', (done) => {
Pack.cacheValue({

@@ -106,3 +106,3 @@ connection: connection,

it('should properly store a string value', function (done){
it('should properly store a string value', (done) => {
shouldProperlyStoreValue({

@@ -116,3 +116,3 @@ connection: connection,

it('should properly store an object', function (done){
it('should properly store an object', (done) => {
shouldProperlyStoreValue({

@@ -128,3 +128,3 @@ connection: connection,

it('should properly store an array', function (done){
it('should properly store an array', (done) => {
shouldProperlyStoreValue({

@@ -147,3 +147,3 @@ connection: connection,

it('should properly store a number', function (done){
it('should properly store a number', (done) => {
// (e.g. if you store `4` it shouldn't end up as `'4'` when it is retrieved)

@@ -157,3 +157,3 @@ shouldProperlyStoreValue({

it('should properly store `null`', function (done){
it('should properly store `null`', (done) => {
shouldProperlyStoreValue({

@@ -166,3 +166,3 @@ connection: connection,

it('should properly store `false`', function (done){
it('should properly store `false`', (done) => {
shouldProperlyStoreValue({

@@ -175,3 +175,3 @@ connection: connection,

it('should properly store `0`', function (done){
it('should properly store `0`', (done) => {
shouldProperlyStoreValue({

@@ -184,3 +184,3 @@ connection: connection,

it('should properly store empty string `\'\'`', function (done){
it('should properly store empty string `\'\'`', (done) => {
shouldProperlyStoreValue({

@@ -194,3 +194,3 @@ connection: connection,

it('should properly store if the key is a number. It is converted to a key',
function (done){
(done) => {
shouldProperlyStoreValue({

@@ -203,3 +203,3 @@ connection: connection,

it('should fail if key is an object', function (done){
it('should fail if key is an object', (done) => {
Pack.cacheValue({

@@ -210,3 +210,3 @@ connection: connection,

}).switch({
error: function (err){
error: function (unusedErr){
done();

@@ -220,3 +220,3 @@ },

it('should fail if key is an array', function (done){
it('should fail if key is an array', (done) => {
Pack.cacheValue({

@@ -227,3 +227,3 @@ connection: connection,

}).switch({
error: function (err){
error: function (unusedErr){
done();

@@ -248,7 +248,7 @@ },

error: function (err){
return done(new Error('Expecting `success` exit'));
return done(new Error('Expecting this to work with no error but instead got: '+err.stack));
},
success: function (){
// first check that it exists in the next 500ms
setTimeout(function (){
setTimeout(() => {
Pack.getCachedValue({

@@ -267,3 +267,3 @@ connection: connection,

// now check that it expired, after 1.5 secs
setTimeout(function (){
setTimeout(() => {
Pack.getCachedValue({

@@ -299,7 +299,7 @@ connection: connection,

// (which automatically releases any connections).
after(function (done){
after((done) => {
Pack.destroyCachedValues({
connection: connection,
keys: keysUsed
}).exec(function (err){
}).exec((err) => {
// If there is an error deleting keys, log it but don't stop

@@ -306,0 +306,0 @@ // (we need to be sure and destroy the manager)

@@ -15,7 +15,7 @@ /**

describe('createConnectionUrl()', function (){
describe('createConnectionUrl()', () => {
describe('with default inputs', function (){
describe('with default inputs', () => {
it ('should return the url redis://127.0.0.1:6379', function() {
it ('should return the url redis://127.0.0.1:6379', () => {
var url = Pack.createConnectionUrl().execSync();

@@ -28,5 +28,5 @@

describe('with host \'redis2go.com\', port \'6380\', password \'secret\' and database \'15\'', function() {
describe('with host \'redis2go.com\', port \'6380\', password \'secret\' and database \'15\'', () => {
it ('should return the url redis://:secret@redis2go.com:6380/15', function() {
it ('should return the url redis://:secret@redis2go.com:6380/15', () => {
var url = Pack.createConnectionUrl({

@@ -33,0 +33,0 @@ host: 'redis2go.com',

@@ -14,3 +14,3 @@ /**

describe('destroyCachedValues()', function (){
describe('destroyCachedValues()', () => {

@@ -32,7 +32,8 @@ // Used to hold manager and active connection throughout the tests below.

// connection from it.
before(function (done){
before((done) => {
Pack.createManager({
connectionString: 'redis://127.0.0.1:6379',
meta: {
auth_pass: 'qwer1234' // use alternative option
auth_pass: 'qwer1234'//eslint-disable-line camelcase
// ^^use alternative option
}

@@ -69,6 +70,6 @@ }).switch({

// ╚═╝╩ ╩╚═╝╩╚═╝ ╚═╝╚═╝╩ ╩╚═╝╚═╝
describe('with basic usage', function (){
describe('with basic usage', () => {
it('should work', function (done){
it('should work', (done) => {

@@ -79,3 +80,3 @@ Pack.cacheValue({

value: 'testValue'
}).exec(function (){
}).exec(() => {
// Now delete keys just to be safe.

@@ -85,3 +86,3 @@ Pack.destroyCachedValues({

keys: ['test1']
}).exec(function (){
}).exec(() => {
// Try to get the value from the cache

@@ -105,3 +106,3 @@ Pack.getCachedValue({

it('should delete keys even if they do not exit', function (done){
it('should delete keys even if they do not exit', (done) => {

@@ -112,3 +113,3 @@ Pack.cacheValue({

value: 'testValue'
}).exec(function (){
}).exec(() => {
// Now delete keys just to be safe.

@@ -118,3 +119,3 @@ Pack.destroyCachedValues({

keys: ['test1']
}).exec(function (){
}).exec(() => {
// Try to get the deleted key from the cache

@@ -150,3 +151,3 @@ Pack.getCachedValue({

it('should fail when passed a string', function (done){
it('should fail when passed a string', (done) => {

@@ -157,3 +158,3 @@ Pack.destroyCachedValues({

}).switch({
error: function (err){
error: function (unusedErr){
return done();

@@ -170,3 +171,3 @@ },

it('should fail when passed a number', function (done){
it('should fail when passed a number', (done) => {

@@ -177,3 +178,3 @@ Pack.destroyCachedValues({

}).switch({
error: function (err){
error: function (unusedErr){
return done();

@@ -189,3 +190,3 @@ },

it('should fail when passed a dictionary', function (done){
it('should fail when passed a dictionary', (done) => {

@@ -196,3 +197,3 @@ Pack.destroyCachedValues({

}).switch({
error: function (err){
error: function (unusedErr){
return done();

@@ -216,7 +217,7 @@ },

// (which automatically releases any connections).
after(function (done){
after((done) => {
Pack.destroyCachedValues({
connection: connection,
keys: keysUsed
}).exec(function (err){
}).exec((err) => {
// If there is an error deleting keys, log it but don't stop

@@ -223,0 +224,0 @@ // (we need to be sure and destroy the manager)

@@ -14,3 +14,3 @@ /**

describe('getCachedValue()', function (){
describe('getCachedValue()', () => {

@@ -25,11 +25,11 @@ // Used to hold manager and active connection throughout the tests below.

// _ _
// | | (_)
// _ __ ___ ___ ___ _ __ _ __ ___ ___| |_ _ ___ _ __
//| '_ \ / _ \ / __/ _ \| '_ \| '_ \ / _ \/ __| __| |/ _ \| '_ \
// _ _
// | | (_)
// _ __ ___ ___ ___ _ __ _ __ ___ ___| |_ _ ___ _ __
//| '_ \ / _ \ / __/ _ \| '_ \| '_ \ / _ \/ __| __| |/ _ \| '_ \
//| | | | (_) | | (_| (_) | | | | | | | __/ (__| |_| | (_) | | | |
//|_| |_|\___/ \___\___/|_| |_|_| |_|\___|\___|\__|_|\___/|_| |_|
//
describe('with no connection', function (){
it('should fail', function (done){
//
describe('with no connection', () => {
it('should fail', (done) => {
Pack.getCachedValue({

@@ -58,3 +58,3 @@ connection: {},

// ╚═╝╩ ╩╚═╝╩╚═╝ ╚═╝╚═╝╩ ╩╚═╝╚═╝
describe('with basic usage', function (){
describe('with basic usage', () => {

@@ -68,3 +68,3 @@

// connection from it. Also delete the specified keys, just to be safe.
before(function (done){
before((done) => {
Pack.createManager({

@@ -99,3 +99,3 @@ connectionString: 'redis://127.0.0.1:6379',

});//</before>
it('should work', function (done){
it('should work', (done) => {
Pack.cacheValue({

@@ -117,3 +117,3 @@ connection: connection,

it('should exit `notFound` if key does not exist', function (done){
it('should exit `notFound` if key does not exist', (done) => {
Pack.getCachedValue({

@@ -134,3 +134,3 @@ connection: connection,

it('should exit `notFound` if the key expired', function (done){
it('should exit `notFound` if the key expired', (done) => {
Pack.cacheValue({

@@ -145,3 +145,3 @@ connection: connection,

setTimeout(
function (){
() => {
Pack.getCachedValue({

@@ -171,7 +171,7 @@ connection: connection,

// (which automatically releases any connections).
after(function (done){
after((done) => {
Pack.destroyCachedValues({
connection: connection,
keys: keysUsed
}).exec(function (err){
}).exec((err) => {
// If there is an error deleting keys, log it but don't stop

@@ -178,0 +178,0 @@ // (we need to be sure and destroy the manager)

@@ -14,3 +14,3 @@ /**

describe('getConnection()', function (){
describe('getConnection()', () => {

@@ -20,5 +20,5 @@ // ╔╗ ╔═╗╔═╗╦╔═╗ ╦ ╦╔═╗╔═╗╔═╗╔═╗

// ╚═╝╩ ╩╚═╝╩╚═╝ ╚═╝╚═╝╩ ╩╚═╝╚═╝
describe('with basic usage', function (){
describe('with basic usage', () => {
it('should connect with a password', function (done){
it('should connect with a password', (done) => {
Pack.createManager({

@@ -43,8 +43,8 @@ connectionString: 'redis://127.0.0.1:6379'

it('should fail to connect to an invalid port', function (done){
it('should fail to connect to an invalid port', (done) => {
Pack.createManager({
connectionString: 'redis://127.0.0.1:9999',
meta: {
connect_timeout: 1000,
retry_strategy: function (){
connect_timeout: 1000,//eslint-disable-line camelcase
retry_strategy: function (){//eslint-disable-line camelcase
return null;

@@ -51,0 +51,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc