X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Futils.test.mjs;h=5feb6596296914252a94231e5de19132968a832f;hb=1b5a0303f57fbff1125882e04766cb0cf9cc000d;hp=bf0c72afadadc78819bd5d938a30f962496f1fee;hpb=229e9e73566ed1960ba5be0534fb3aa2eeb115eb;p=poolifier.git diff --git a/tests/pools/utils.test.mjs b/tests/pools/utils.test.mjs index bf0c72af..5feb6596 100644 --- a/tests/pools/utils.test.mjs +++ b/tests/pools/utils.test.mjs @@ -1,9 +1,15 @@ +import { Worker as ThreadWorker } from 'node:worker_threads' +import { Worker as ClusterWorker } from 'node:cluster' import { expect } from 'expect' import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../../lib/circular-array.js' -import { updateMeasurementStatistics } from '../../lib/pools/utils.js' +import { + createWorker, + updateMeasurementStatistics +} from '../../lib/pools/utils.js' +import { WorkerTypes } from '../../lib/index.js' describe('Pool utils test suite', () => { it('Verify updateMeasurementStatistics() behavior', () => { @@ -92,4 +98,19 @@ describe('Pool utils test suite', () => { ) }) }) + + it('Verify createWorker() behavior', () => { + expect( + createWorker( + WorkerTypes.thread, + './tests/worker-files/thread/testWorker.mjs' + ) + ).toBeInstanceOf(ThreadWorker) + expect( + createWorker( + WorkerTypes.cluster, + './tests/worker-files/cluster/testWorker.mjs' + ) + ).toBeInstanceOf(ClusterWorker) + }) })