start adding tests for the worker

This commit is contained in:
2016-04-18 16:39:48 -07:00
parent 1b5f2af004
commit 9d07023453

39
test/src/worker.js Normal file
View File

@@ -0,0 +1,39 @@
import expect from 'expect.js';
import Worker from '../../lib/worker';
describe('Worker', function () {
describe('invalid construction', function () {
let mockQueue;
beforeEach(function () {
mockQueue = {};
});
it('should throw without a type', function () {
const init = () => new Worker(mockQueue);
expect(init).to.throwException(/type.+string/i);
});
it('should throw without an invalid type', function () {
const init = () => new Worker(mockQueue, { string: false });
expect(init).to.throwException(/type.+string/i);
});
it('should throw without a worker', function () {
const init = () => new Worker(mockQueue, 'test');
expect(init).to.throwException(/worker.+function/i);
});
it('should throw with an invalid worker', function () {
const init = () => new Worker(mockQueue, 'test', { function: false });
expect(init).to.throwException(/worker.+function/i);
});
});
// describe('construction', function () {
// it('should have a unique ID', function () {
// var worker = new Worker(mockQueue);
// });
// });
});