diff --git a/lib/prefix_acoltatore.js b/lib/prefix_acoltatore.js index 12704df..f0c39cc 100644 --- a/lib/prefix_acoltatore.js +++ b/lib/prefix_acoltatore.js @@ -38,7 +38,7 @@ PrefixAscoltatore.prototype.wrapCallback = function(callback, next) { PrefixAscoltatore.prototype._localToParent = function(topic) { var newTopic = this._prefix; - newTopic += (topic.indexOf('/') != 0) ? '/' : ''; + newTopic += (topic.indexOf('/') !== 0) ? '/' : ''; newTopic += topic; debug("rewriting local topic " + topic + " into " + newTopic); return newTopic; diff --git a/test/prefix_ascoltatore_spec.js b/test/prefix_ascoltatore_spec.js index 345666b..d4ad899 100644 --- a/test/prefix_ascoltatore_spec.js +++ b/test/prefix_ascoltatore_spec.js @@ -18,4 +18,15 @@ describe("ascoltatori.PrefixAscoltatore", function() { that.instance.publish("/hello", "world"); }); }); + + it("should pass options through", function(done) { + var that = this; + var opts = { hello: "world" }; + this.instance.subscribe("/hello", function(topic, payload, receivedOpts) { + expect(receivedOpts).to.eql(opts); + done(); + }, function() { + that.instance.publish("/hello", "world", opts); + }); + }); });