X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker%2Fthread-worker.test.js;h=624e395c04f80cb752adc73f8e95d84b19300dab;hb=ffcbbad84f63b8a77f2b1a08f82deef5430f646e;hp=dfe49655f10c7380604dd2edcfad5d30e030bf98;hpb=74a2a19445618440f22537123650c01d065ae358;p=poolifier.git diff --git a/tests/worker/thread-worker.test.js b/tests/worker/thread-worker.test.js index dfe49655..624e395c 100644 --- a/tests/worker/thread-worker.test.js +++ b/tests/worker/thread-worker.test.js @@ -1,21 +1,20 @@ -const expect = require('expect') +const { expect } = require('expect') const { ThreadWorker } = require('../../lib') -let numberOfMessagesPosted = 0 -const postMessage = function (message) { - numberOfMessagesPosted++ - console.log(message) -} -class SpyWorker extends ThreadWorker { - getMainWorker () { - return { postMessage: postMessage } +describe('Thread worker test suite', () => { + let numberOfMessagesPosted = 0 + const postMessage = function () { + ++numberOfMessagesPosted + } + class SpyWorker extends ThreadWorker { + getMainWorker () { + return { postMessage } + } } -} -describe('Thread worker test suite', () => { it('Verify worker has default maxInactiveTime', () => { const worker = new ThreadWorker(() => {}) - expect(worker.maxInactiveTime).toEqual(60_000) + expect(worker.opts.maxInactiveTime).toStrictEqual(60000) }) it('Verify worker invoke the getMainWorker and postMessage methods', () => {