From 9d0702345382b99e7f00f9a59b8420965ceafbdd Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Mon, 18 Apr 2016 16:39:48 -0700 Subject: [PATCH] start adding tests for the worker --- test/src/worker.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/src/worker.js diff --git a/test/src/worker.js b/test/src/worker.js new file mode 100644 index 0000000..ff76de9 --- /dev/null +++ b/test/src/worker.js @@ -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); + // }); + // }); + +});