From 5ce288fd728e13b547d93cbb6d8dd355024affa2 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 15 Apr 2016 17:29:40 -0700 Subject: [PATCH] ensure objects are event emitters --- test/src/index.js | 8 +++++++- test/src/job.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/src/index.js b/test/src/index.js index 9469d89..9a1f9f0 100644 --- a/test/src/index.js +++ b/test/src/index.js @@ -1,7 +1,13 @@ -import Elastique from '../../lib/index'; +import events from 'events'; import expect from 'expect.js'; +import Elastique from '../../lib/index'; describe('Elastique class', function () { + it('should be an event emitter', function () { + const queue = new Elastique('elastique'); + expect(queue).to.be.an(events.EventEmitter); + }); + describe('Option validation', function () { it('should throw without an index', function () { const init = () => new Elastique(); diff --git a/test/src/job.js b/test/src/job.js index ffc7703..7bfc3dd 100644 --- a/test/src/job.js +++ b/test/src/job.js @@ -1,3 +1,4 @@ +import events from 'events'; import expect from 'expect.js'; import sinon from 'sinon'; import Job from '../../lib/job'; @@ -12,7 +13,12 @@ describe('Jobs', function () { }; }); - describe('invlaid construction', function () { + it('should be an event emitter', function () { + const job = new Job(mockQueue, 'test', {}); + expect(job).to.be.an(events.EventEmitter); + }); + + describe('invalid construction', function () { it('should throw with a missing type', function () { const init = () => new Job(mockQueue); expect(init).to.throwException(/type.+string/i);