Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
✅ Add endpoint tests for .start() and .options()
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Dec 4, 2017
1 parent 31e2fd6 commit 14ac537
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/endpoint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ describe('Endpoint', function () {
remit = Remit({name: 'endpointRemit'})
})

it('should return same start promise if called multiple times', function () {
const endpoint = remit.endpoint('start-test', () => {})
const start1 = endpoint.start()
const start2 = endpoint.start()

expect(start1).to.equal(start2)
})

it('should assign new options over old ones', function () {
const endpoint = remit.endpoint('options-test')
expect(endpoint._options).to.have.property('event', 'options-test')
Expand All @@ -75,6 +83,15 @@ describe('Endpoint', function () {
expect(endpoint._options).to.have.property('queue', 'options-queue')
})

it('should accept blank options (no changes)', function () {
const endpoint = remit.endpoint('options-blank')
expect(endpoint._options).to.have.property('event', 'options-blank')
expect(endpoint._options).to.have.property('queue', 'options-blank')
endpoint.options()
expect(endpoint._options).to.have.property('event', 'options-blank')
expect(endpoint._options).to.have.property('queue', 'options-blank')
})

it('should not start consuming until `start` called')

it('should throw if handler not specified on start', function () {
Expand Down

0 comments on commit 14ac537

Please sign in to comment.