From b2ff6bc291e11208aa9100479cb0469bd77e634a Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Mon, 18 Apr 2016 17:44:39 -0700 Subject: [PATCH] add test for unique worker id --- test/src/worker.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/test/src/worker.js b/test/src/worker.js index ff76de9..77ebccf 100644 --- a/test/src/worker.js +++ b/test/src/worker.js @@ -1,14 +1,15 @@ import expect from 'expect.js'; +import { noop } from 'lodash'; import Worker from '../../lib/worker'; -describe('Worker', function () { +describe('Worker class', function () { + let mockQueue; + + beforeEach(function () { + mockQueue = {}; + }); + 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); @@ -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); + }); + }); });