X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fthread%2FtestWorker.js;h=5779e231d0903c49edb0d85bd225e8ff1b1027ef;hb=daf86646c7cdb484ec05165a49c12224da11a4c7;hp=369dbdba477bc8f7f60c50976fd513e387f5ed5e;hpb=6e9d10db05ac2bbc85373195a5c885d2492fee61;p=poolifier.git diff --git a/tests/worker-files/thread/testWorker.js b/tests/worker-files/thread/testWorker.js index 369dbdba..5779e231 100644 --- a/tests/worker-files/thread/testWorker.js +++ b/tests/worker-files/thread/testWorker.js @@ -1,15 +1,12 @@ 'use strict' -const { ThreadWorker, KillBehaviors } = require('../../../lib/index') -const { isMainThread } = require('worker_threads') +const { ThreadWorker, KillBehaviors } = require('../../../lib') +const { executeWorkerFunction } = require('../../test-utils') +const { WorkerFunctions } = require('../../test-types') function test (data) { - for (let i = 0; i < 50; i++) { - const o = { - a: i - } - JSON.stringify(o) - } - return isMainThread + data = data || {} + data.function = data.function || WorkerFunctions.jsonIntegerSerialization + return executeWorkerFunction(data) } module.exports = new ThreadWorker(test, {