-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rod
committed
Feb 16, 2018
1 parent
5e00211
commit d7950fc
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
assert = require 'assert' | ||
fs = require 'fs' | ||
path = require 'path' | ||
HOMEDIR = path.join(__dirname,'..') | ||
LIB_COV = path.join(HOMEDIR,'lib-cov') | ||
LIB = path.join(HOMEDIR,'lib') | ||
LIB_DIR = if fs.existsSync(LIB_COV) then LIB_COV else LIB | ||
AmqpBase = require(path.join(LIB_DIR,'amqp-base')).AmqpBase | ||
|
||
describe 'AmqpBase',-> | ||
|
||
it "will not disconnect a connection it did not create (unless explicitly asked to)", (done)=> | ||
mock_connection = { | ||
disconnect:(cb)=> | ||
mock_connection.disconnect_called = true | ||
cb?() | ||
} | ||
obj = new AmqpBase(mock_connection) | ||
obj.disconnect (err)=> | ||
assert.ok err? | ||
assert not mock_connection.disconnect_called | ||
obj.disconnect true, (err)=> | ||
assert.ok not err?, err | ||
assert mock_connection.disconnect_called | ||
done() |