Skip to content

Commit

Permalink
Merge pull request #2 from DaMouse404/create-export
Browse files Browse the repository at this point in the history
Add .create function to match sqs-producer
  • Loading branch information
robinjmurphy committed Feb 16, 2015
2 parents 388bc22 + 0295897 commit 737276c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ function Consumer(options) {

util.inherits(Consumer, EventEmitter);

/**
* Construct a new Consumer
*/
Consumer.create = function(options) {
return new Consumer(options);
};

/**
* Start polling for messages.
*/
Expand Down
13 changes: 13 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ describe('Consumer', function () {
});
});

describe('.create', function () {
it('creates a new instance of a Consumer object', function() {
var consumer = Consumer.create({
region: 'some-region',
queueUrl: 'some-queue-url',
batchSize: 1,
handleMessage: handleMessage
});

assert(consumer instanceof Consumer);
});
});

describe('.start', function () {
it('fires an error event when an error occurs receiving a message', function (done) {
var receiveErr = new Error('Receive error');
Expand Down

0 comments on commit 737276c

Please sign in to comment.