Skip to content

Commit

Permalink
oops, add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
Rod committed Feb 16, 2018
1 parent 5e00211 commit d7950fc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/test-amqp-base.coffee
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()

0 comments on commit d7950fc

Please sign in to comment.