Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
Added missing test for PrefixAscoltatore options.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Jan 15, 2014
1 parent 1a7f48d commit 2a04353
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/prefix_acoltatore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions test/prefix_ascoltatore_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});

0 comments on commit 2a04353

Please sign in to comment.