@twilson63/palmetto-rmq
Advanced tools
Comparing version 1.0.4 to 1.0.5
var EventEmitter = require('events').EventEmitter | ||
var ee = new EventEmitter() | ||
var servicebus = require('servicebus') | ||
module.exports = function (config) { | ||
@@ -10,3 +10,3 @@ // validate config | ||
var bus = require('servicebus').bus({ | ||
var bus = servicebus.bus({ | ||
url: config.endpoint, | ||
@@ -13,0 +13,0 @@ vhost: config.vhost || null |
{ | ||
"name": "@twilson63/palmetto-rmq", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "tap test" | ||
}, | ||
@@ -13,3 +13,4 @@ "keywords": [], | ||
"devDependencies": { | ||
"tap": "^1.1.0" | ||
"rewire": "^2.3.3", | ||
"tap": "^1.2.0" | ||
}, | ||
@@ -16,0 +17,0 @@ "dependencies": { |
@@ -5,2 +5,4 @@ # Palmetto RMQ | ||
[![Build Status](https://travis-ci.org/twilson63/palmetto-rmq.svg?branch=master)](https://travis-ci.org/twilson63/palmetto-rmq) | ||
## usage | ||
@@ -7,0 +9,0 @@ |
var test = require('tap').test | ||
var pr = require('../') | ||
var rewire = require('rewire') | ||
var palmetto = rewire('../') | ||
test('publish', function (t) { | ||
var ee = pr({ | ||
palmetto.__set__('servicebus', { | ||
bus: function () { | ||
return { | ||
subscribe: function() {}, | ||
publish: function (n, e) { | ||
t.equals(n, 'foo', 'should equal app name') | ||
t.deepEquals(e, { to: 'widget.request.create', name: 'foobar'}, 'should equal object') | ||
} | ||
} | ||
} | ||
}) | ||
var ee = palmetto({ | ||
endpoint: 'amqp://guest:guest@localhost:5672', | ||
@@ -7,0 +21,0 @@ app: 'foo' |
var test = require('tap').test | ||
var pr = require('../') | ||
var rewire = require('rewire') | ||
var palmetto = rewire('../') | ||
test('subscribe', function (t) { | ||
var ee = pr({ | ||
palmetto.__set__('servicebus', { | ||
bus: function () { | ||
return { | ||
subscribe: function(n, fn) { | ||
setTimeout(function () { | ||
fn({ to: 'foo.bar', from: 'beepboop' }) | ||
}, 50) | ||
}, | ||
publish: function () {} | ||
} | ||
} | ||
}) | ||
var ee = palmetto({ | ||
endpoint: 'amqp://guest:guest@localhost:5672', | ||
app: 'foo' | ||
}) | ||
var msg = { to: 'widget.request.create', name: 'foobar'} | ||
ee.on(msg.to, function (event) { | ||
console.log(event) | ||
console.log('notified') | ||
ee.on('foo.bar', function (event) { | ||
t.equals(event.to, 'foo.bar') | ||
t.equals(event.from, 'beepboop') | ||
t.end() | ||
}) | ||
setTimeout(function() { | ||
ee.emit('send', msg) | ||
console.log('sent') | ||
}, 500) | ||
}) | ||
}) |
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
3686
7
66
1
67
2