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