amqp-wrapper
Advanced tools
Comparing version 7.0.0-es6.1 to 7.0.0-es6.2
@@ -38,4 +38,4 @@ const amqp = require('amqplib'); | ||
const { config } = this; | ||
const conn = await amqp.connect(config.url); | ||
this.channel = await conn.createConfirmChannel(); | ||
this.connection = await amqp.connect(config.url); | ||
this.channel = await this.connection.createConfirmChannel(); | ||
this.channel.prefetch(this.prefetch); | ||
@@ -42,0 +42,0 @@ await this.channel.assertExchange(config.exchange, 'topic', {}); |
{ | ||
"name": "amqp-wrapper", | ||
"version": "7.0.0-es6.1", | ||
"version": "7.0.0-es6.2", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">= 8" |
@@ -28,3 +28,3 @@ amqp-wrapper | ||
```javascript | ||
var AMQP = require('amqp-wrapper'); | ||
const AMQP = require('amqp-wrapper'); | ||
@@ -45,3 +45,3 @@ var config = { | ||
var amqp = AMQP(config); | ||
const amqp = new AMQP(config); | ||
@@ -90,5 +90,2 @@ async function main () { | ||
> amqp-wrapper@6.0.0 docs /Users/tim/git/node-amqp-wrapper | ||
> jsdoc2md amqp.js | ||
<a name="AMQPWrapper"></a> | ||
@@ -95,0 +92,0 @@ |
@@ -176,4 +176,18 @@ const SandboxedModule = require('sandboxed-module'); | ||
}); | ||
describe('#close', function () { | ||
it('should close the connection', async function () { | ||
var amqpLibMock = require('./amqplibmock')(); | ||
var MockedAMQP = SandboxedModule.require('../amqp', { | ||
requires: { | ||
'amqplib': amqpLibMock.mock | ||
} | ||
}); | ||
const amqp = new MockedAMQP(config.good); | ||
await amqp.connect(); | ||
await amqp.close(); | ||
expect(amqpLibMock.closeConnectionSpy).to.have.been.called(); | ||
}); | ||
}); | ||
}); | ||
// vim: set et sw=2 colorcolumn=80: |
@@ -24,6 +24,9 @@ /** | ||
var connectionMock = { | ||
createConfirmChannel: Sinon.stub().resolves(channelMock), | ||
close: Sinon.stub().resolves() | ||
}; | ||
var amqpLibMock = { | ||
connect: Sinon.stub().resolves({ | ||
createConfirmChannel: Sinon.stub().resolves(channelMock) | ||
}) | ||
connect: Sinon.stub().resolves(connectionMock) | ||
}; | ||
@@ -37,4 +40,5 @@ | ||
nackSpy: channelMock.nack, | ||
channelMock: channelMock | ||
channelMock: channelMock, | ||
closeConnectionSpy: connectionMock.close | ||
}; | ||
}; |
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
23315
406
191