add test for unique worker id

This commit is contained in:
2016-04-18 17:44:39 -07:00
parent 3d89a3e86c
commit b2ff6bc291

View File

@@ -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);
});
});
});