queue should track and tear down workers, with tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import events from 'events';
|
||||
import expect from 'expect.js';
|
||||
import sinon from 'sinon';
|
||||
import { noop } from 'lodash';
|
||||
import elasticsearchMock from '../fixtures/elasticsearch';
|
||||
import Elastique from '../../lib/index';
|
||||
|
||||
@@ -47,4 +48,17 @@ describe('Elastique class', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Registering workers', function () {
|
||||
it('should keep track of workers', function () {
|
||||
const queue = new Elastique('elastique', { client });
|
||||
expect(queue.workers).to.eql([]);
|
||||
expect(queue.workers).to.have.length(0);
|
||||
|
||||
queue.registerWorker('test', noop);
|
||||
queue.registerWorker('test', noop);
|
||||
queue.registerWorker('test2', noop);
|
||||
expect(queue.workers).to.have.length(3);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user