ensure objects are event emitters
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user