mqemitter-redis
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -21,4 +21,4 @@ 'use strict' | ||
this.subConn = new Redis(opts.connectionString || opts) | ||
this.pubConn = new Redis(opts.connectionString || opts) | ||
this.subConn = opts.subConn || new Redis(opts.connectionString || opts) | ||
this.pubConn = opts.pubConn || new Redis(opts.connectionString || opts) | ||
@@ -25,0 +25,0 @@ this._pipeline = Pipeline(this.pubConn) |
{ | ||
"name": "mqemitter-redis", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Redis-based MQEmitter", | ||
@@ -5,0 +5,0 @@ "main": "mqemitter-redis.js", |
49
test.js
'use strict' | ||
const redis = require('./') | ||
const Redis = require('ioredis') | ||
const test = require('tape').test | ||
@@ -117,1 +118,49 @@ const abstractTests = require('mqemitter/abstractTest.js') | ||
}) | ||
test('external redis pubConn and subConn', function (t) { | ||
t.plan(4) | ||
const externalRedisSubConn = new Redis() | ||
externalRedisSubConn.on('error', e => { | ||
t.notOk(e) | ||
}) | ||
externalRedisSubConn.on('connect', () => { | ||
t.pass('redis subConn connected') | ||
}) | ||
const externalRedisPubConn = new Redis() | ||
externalRedisPubConn.on('error', e => { | ||
t.notOk(e) | ||
}) | ||
externalRedisPubConn.on('connect', () => { | ||
t.pass('redis pubConn connected') | ||
}) | ||
const e = redis({ | ||
subConn: externalRedisSubConn, | ||
pubConn: externalRedisPubConn | ||
}) | ||
let subConnectEventReceived = false | ||
let pubConnectEventReceived = false | ||
e.state.on('pubConnect', function () { | ||
pubConnectEventReceived = true | ||
newConnectionEvent() | ||
}) | ||
e.state.on('subConnect', function () { | ||
subConnectEventReceived = true | ||
newConnectionEvent() | ||
}) | ||
function newConnectionEvent () { | ||
if (subConnectEventReceived && pubConnectEventReceived) { | ||
e.close(function () { | ||
t.equal(e.subConn, externalRedisSubConn, 'uses external redis subConn') | ||
t.equal(e.pubConn, externalRedisPubConn, 'uses external redis pubConn') | ||
t.end() | ||
}) | ||
} | ||
} | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15825
368