Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Nov 17, 2016
1 parent ff779ab commit 7e2b679
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/pubsub/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ PubSub.prototype.subscribe = function(topic, subName, options, callback) {
}

if (is.object(subName)) {
callback = options;
options = subName;
subName = '';
}
Expand Down
22 changes: 22 additions & 0 deletions packages/pubsub/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,16 @@ describe('PubSub', function() {
pubsub.subscribe(TOPIC_NAME, done);
});

it('should not require a sub name and accept options', function(done) {
var opts = {};

pubsub.request = function(protoOpts, reqOpts, callback) {
callback(null, apiResponse);
};

pubsub.subscribe(TOPIC_NAME, opts, done);
});

it('should not require configuration options', function(done) {
pubsub.request = function(protoOpts, reqOpts, callback) {
callback(null, apiResponse);
Expand Down Expand Up @@ -724,6 +734,18 @@ describe('PubSub', function() {
pubsub.subscription();
});

it('should not require a name and accept options', function(done) {
SubscriptionOverride = function(pubsub, options) {
var expectedOptions = extend({}, CONFIG);
expectedOptions.name = undefined;

assert.deepEqual(options, expectedOptions);
done();
};

pubsub.subscription(CONFIG);
});

it('should not require options', function(done) {
SubscriptionOverride = function(pubsub, options) {
assert.deepEqual(options, {
Expand Down

0 comments on commit 7e2b679

Please sign in to comment.