X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fthread%2FtestWorker.js;h=5779e231d0903c49edb0d85bd225e8ff1b1027ef;hb=67e8ef11907ab8ae70740d7c9f4d5d225ed8d522;hp=c70069c7269f17d2f83069554d0e3fba5d2a15e6;hpb=e901162fa610e2af305aac504549580b2de48cab;p=poolifier.git diff --git a/tests/worker-files/thread/testWorker.js b/tests/worker-files/thread/testWorker.js index c70069c7..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, {