add test for unique worker id
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import expect from 'expect.js';
|
||||
import { noop } from 'lodash';
|
||||
import Worker from '../../lib/worker';
|
||||
|
||||
describe('Worker', function () {
|
||||
describe('invalid construction', function () {
|
||||
describe('Worker class', function () {
|
||||
let mockQueue;
|
||||
|
||||
beforeEach(function () {
|
||||
mockQueue = {};
|
||||
});
|
||||
|
||||
describe('invalid construction', function () {
|
||||
it('should throw without a type', function () {
|
||||
const init = () => new Worker(mockQueue);
|
||||
expect(init).to.throwException(/type.+string/i);
|
||||
@@ -30,10 +31,16 @@ describe('Worker', function () {
|
||||
});
|
||||
});
|
||||
|
||||
// describe('construction', function () {
|
||||
// it('should have a unique ID', function () {
|
||||
// var worker = new Worker(mockQueue);
|
||||
// });
|
||||
// });
|
||||
describe('construction', function () {
|
||||
it('should have a unique ID', function () {
|
||||
var worker = new Worker(mockQueue, 'test', noop);
|
||||
expect(worker.id).to.be.a('string');
|
||||
|
||||
var worker2 = new Worker(mockQueue, 'test', noop);
|
||||
expect(worker2.id).to.be.a('string');
|
||||
|
||||
expect(worker.id).to.not.equal(worker2.id);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user