From: Jérôme Benoit Date: Mon, 10 Oct 2022 12:04:47 +0000 (+0200) Subject: Stricter tests expectations X-Git-Tag: v2.3.1~43 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6db75ad932064c1415ff6f03645929530209a5fe;p=poolifier.git Stricter tests expectations Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 6a4da63d..54b32ec0 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -211,7 +211,7 @@ describe('Abstract pool test suite', () => { ) const promises = [] for (let i = 0; i < numberOfWorkers * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } for (const tasksUsage of pool.workersTasksUsage.values()) { expect(tasksUsage).toBeDefined() @@ -240,7 +240,7 @@ describe('Abstract pool test suite', () => { let poolBusy = 0 pool.emitter.on('busy', () => poolBusy++) for (let i = 0; i < numberOfWorkers * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers. diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index 61e1d6e2..bd7a0672 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -1,5 +1,6 @@ const { expect } = require('expect') const { DynamicClusterPool } = require('../../../lib/index') +const WorkerFunctions = require('../../test-types') const TestUtils = require('../../test-utils') const min = 1 const max = 3 @@ -14,9 +15,14 @@ const pool = new DynamicClusterPool( describe('Dynamic cluster pool test suite', () => { it('Verify that the function is executed in a worker cluster', async () => { - const result = await pool.execute({ test: 'test' }) - expect(result).toBeDefined() - expect(result).toBeFalsy() + let result = await pool.execute({ + function: WorkerFunctions.fibonacci + }) + expect(result).toBe(false) + result = await pool.execute({ + function: WorkerFunctions.factorial + }) + expect(result).toBe(false) }) it('Verify that new workers are created when required, max size is not exceeded and that after a while new workers will die', async () => { @@ -24,7 +30,7 @@ describe('Dynamic cluster pool test suite', () => { let poolBusy = 0 pool.emitter.on('busy', () => poolBusy++) for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } expect(pool.workers.length).toBeLessThanOrEqual(max) expect(pool.workers.length).toBeGreaterThan(min) @@ -38,13 +44,13 @@ describe('Dynamic cluster pool test suite', () => { it('Verify scale worker up and down is working', async () => { expect(pool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - pool.execute({ test: 'test' }) + pool.execute() } expect(pool.workers.length).toBeGreaterThan(min) await TestUtils.waitExits(pool, max - min) expect(pool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - pool.execute({ test: 'test' }) + pool.execute() } expect(pool.workers.length).toBeGreaterThan(min) await TestUtils.waitExits(pool, max - min) @@ -70,9 +76,8 @@ describe('Dynamic cluster pool test suite', () => { 1, './tests/worker-files/cluster/testWorker.js' ) - const result = await pool1.execute({ test: 'test' }) - expect(result).toBeDefined() - expect(result).toBeFalsy() + const result = await pool1.execute() + expect(result).toBe(false) // We need to clean up the resources after our test await pool1.destroy() }) @@ -90,7 +95,7 @@ describe('Dynamic cluster pool test suite', () => { ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - longRunningPool.execute({ test: 'test' }) + longRunningPool.execute() } expect(longRunningPool.workers.length).toBe(max) await TestUtils.waitExits(longRunningPool, max - min) @@ -113,7 +118,7 @@ describe('Dynamic cluster pool test suite', () => { ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - longRunningPool.execute({ test: 'test' }) + longRunningPool.execute() } expect(longRunningPool.workers.length).toBe(max) await TestUtils.sleep(1500) diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 2ef709c1..5bc9d77e 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -1,5 +1,6 @@ const { expect } = require('expect') const { FixedClusterPool } = require('../../../lib/index') +const WorkerFunctions = require('../../test-types') const TestUtils = require('../../test-utils') const numberOfWorkers = 10 const pool = new FixedClusterPool( @@ -56,15 +57,19 @@ describe('Fixed cluster pool test suite', () => { }) it('Verify that the function is executed in a worker cluster', async () => { - const result = await pool.execute({ test: 'test' }) - expect(result).toBeDefined() - expect(result).toBeFalsy() + let result = await pool.execute({ + function: WorkerFunctions.fibonacci + }) + expect(result).toBe(false) + result = await pool.execute({ + function: WorkerFunctions.factorial + }) + expect(result).toBe(false) }) it('Verify that is possible to invoke the execute method without input', async () => { const result = await pool.execute() - expect(result).toBeDefined() - expect(result).toBeFalsy() + expect(result).toBe(false) }) it('Verify that busy event is emitted', async () => { @@ -72,7 +77,7 @@ describe('Fixed cluster pool test suite', () => { let poolBusy = 0 pool.emitter.on('busy', () => poolBusy++) for (let i = 0; i < numberOfWorkers * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers. // So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the fixed pool. @@ -81,14 +86,13 @@ describe('Fixed cluster pool test suite', () => { it('Verify that is possible to have a worker that return undefined', async () => { const result = await emptyPool.execute() - expect(result).toBeFalsy() + expect(result).toBeUndefined() }) it('Verify that data are sent to the worker correctly', async () => { const data = { f: 10 } const result = await echoPool.execute(data) - expect(result).toBeTruthy() - expect(result.f).toBe(data.f) + expect(result).toEqual(data) }) it('Verify that error handling is working properly:sync', async () => { @@ -122,8 +126,7 @@ describe('Fixed cluster pool test suite', () => { const startTime = new Date().getTime() const result = await asyncPool.execute(data) const usedTime = new Date().getTime() - startTime - expect(result).toBeTruthy() - expect(result.f).toBe(data.f) + expect(result).toEqual(data) expect(usedTime).toBeGreaterThanOrEqual(2000) }) @@ -139,8 +142,8 @@ describe('Fixed cluster pool test suite', () => { 1, './tests/worker-files/cluster/testWorker.js' ) - const res = await pool1.execute({ test: 'test' }) - expect(res).toBeFalsy() + const res = await pool1.execute() + expect(res).toBe(false) // We need to clean up the resources after our test await pool1.destroy() }) diff --git a/tests/pools/selection-strategies/selection-strategies.test.js b/tests/pools/selection-strategies/selection-strategies.test.js index 39895b21..bc6d0b32 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -85,7 +85,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -107,7 +107,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -178,7 +178,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `LessRecentlyUsedWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -197,7 +197,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `LessRecentlyUsedWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -268,7 +268,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `FairShareChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -287,7 +287,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `FairShareChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -358,7 +358,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test @@ -377,7 +377,7 @@ describe('Selection strategies test suite', () => { // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose` const promises = [] for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } await Promise.all(promises) // We need to clean up the resources after our test diff --git a/tests/pools/thread/dynamic.test.js b/tests/pools/thread/dynamic.test.js index 94320429..5a85f6ae 100644 --- a/tests/pools/thread/dynamic.test.js +++ b/tests/pools/thread/dynamic.test.js @@ -1,5 +1,6 @@ const { expect } = require('expect') const { DynamicThreadPool } = require('../../../lib/index') +const WorkerFunctions = require('../../test-types') const TestUtils = require('../../test-utils') const min = 1 const max = 3 @@ -14,9 +15,14 @@ const pool = new DynamicThreadPool( describe('Dynamic thread pool test suite', () => { it('Verify that the function is executed in a worker thread', async () => { - const result = await pool.execute({ test: 'test' }) - expect(result).toBeDefined() - expect(result).toBeFalsy() + let result = await pool.execute({ + function: WorkerFunctions.fibonacci + }) + expect(result).toBe(false) + result = await pool.execute({ + function: WorkerFunctions.factorial + }) + expect(result).toBe(false) }) it('Verify that new workers are created when required, max size is not exceeded and that after a while new workers will die', async () => { @@ -24,7 +30,7 @@ describe('Dynamic thread pool test suite', () => { let poolBusy = 0 pool.emitter.on('busy', () => poolBusy++) for (let i = 0; i < max * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } expect(pool.workers.length).toBeLessThanOrEqual(max) expect(pool.workers.length).toBeGreaterThan(min) @@ -38,13 +44,13 @@ describe('Dynamic thread pool test suite', () => { it('Verify scale thread up and down is working', async () => { expect(pool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - pool.execute({ test: 'test' }) + pool.execute() } expect(pool.workers.length).toBe(max) await TestUtils.waitExits(pool, max - min) expect(pool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - pool.execute({ test: 'test' }) + pool.execute() } expect(pool.workers.length).toBe(max) await TestUtils.waitExits(pool, max - min) @@ -70,9 +76,8 @@ describe('Dynamic thread pool test suite', () => { 1, './tests/worker-files/thread/testWorker.js' ) - const res = await pool1.execute({ test: 'test' }) - expect(res).toBeDefined() - expect(res).toBeFalsy() + const res = await pool1.execute() + expect(res).toBe(false) // We need to clean up the resources after our test await pool1.destroy() }) @@ -90,7 +95,7 @@ describe('Dynamic thread pool test suite', () => { ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - longRunningPool.execute({ test: 'test' }) + longRunningPool.execute() } expect(longRunningPool.workers.length).toBe(max) await TestUtils.waitExits(longRunningPool, max - min) @@ -112,7 +117,7 @@ describe('Dynamic thread pool test suite', () => { ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { - longRunningPool.execute({ test: 'test' }) + longRunningPool.execute() } expect(longRunningPool.workers.length).toBe(max) await TestUtils.sleep(1500) diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 785c6e5d..8a2b90c2 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -1,5 +1,6 @@ const { expect } = require('expect') const { FixedThreadPool } = require('../../../lib/index') +const WorkerFunctions = require('../../test-types') const TestUtils = require('../../test-utils') const numberOfThreads = 10 const pool = new FixedThreadPool( @@ -56,15 +57,19 @@ describe('Fixed thread pool test suite', () => { }) it('Verify that the function is executed in a worker thread', async () => { - const result = await pool.execute({ test: 'test' }) - expect(result).toBeDefined() - expect(result).toBeFalsy() + let result = await pool.execute({ + function: WorkerFunctions.fibonacci + }) + expect(result).toBe(false) + result = await pool.execute({ + function: WorkerFunctions.factorial + }) + expect(result).toBe(false) }) it('Verify that is possible to invoke the execute method without input', async () => { const result = await pool.execute() - expect(result).toBeDefined() - expect(result).toBeFalsy() + expect(result).toBe(false) }) it('Verify that busy event is emitted', async () => { @@ -72,7 +77,7 @@ describe('Fixed thread pool test suite', () => { let poolBusy = 0 pool.emitter.on('busy', () => poolBusy++) for (let i = 0; i < numberOfThreads * 2; i++) { - promises.push(pool.execute({ test: 'test' })) + promises.push(pool.execute()) } // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers. // So in total numberOfThreads + 1 times for a loop submitting up to numberOfThreads * 2 tasks to the fixed pool. @@ -81,14 +86,13 @@ describe('Fixed thread pool test suite', () => { it('Verify that is possible to have a worker that return undefined', async () => { const result = await emptyPool.execute() - expect(result).toBeFalsy() + expect(result).toBeUndefined() }) it('Verify that data are sent to the worker correctly', async () => { const data = { f: 10 } const result = await echoPool.execute(data) - expect(result).toBeTruthy() - expect(result.f).toBe(data.f) + expect(result).toEqual(data) }) it('Verify that error handling is working properly:sync', async () => { @@ -126,8 +130,7 @@ describe('Fixed thread pool test suite', () => { const startTime = new Date().getTime() const result = await asyncPool.execute(data) const usedTime = new Date().getTime() - startTime - expect(result).toBeTruthy() - expect(result.f).toBe(data.f) + expect(result).toEqual(data) expect(usedTime).toBeGreaterThanOrEqual(2000) }) @@ -143,8 +146,8 @@ describe('Fixed thread pool test suite', () => { 1, './tests/worker-files/thread/testWorker.js' ) - const res = await pool1.execute({ test: 'test' }) - expect(res).toBeFalsy() + const res = await pool1.execute() + expect(res).toBe(false) // We need to clean up the resources after our test await pool1.destroy() }) diff --git a/tests/test-types.js b/tests/test-types.js new file mode 100644 index 00000000..01240310 --- /dev/null +++ b/tests/test-types.js @@ -0,0 +1,7 @@ +const WorkerFunctions = { + jsonIntegerSerialization: 'jsonIntegerSerialization', + fibonacci: 'fibonacci', + factorial: 'factorial' +} + +module.exports = WorkerFunctions diff --git a/tests/test-utils.js b/tests/test-utils.js index 4dace47e..31a33c62 100644 --- a/tests/test-utils.js +++ b/tests/test-utils.js @@ -1,3 +1,5 @@ +const WorkerFunctions = require('./test-types') + class TestUtils { static async waitExits (pool, numberOfExitEventsToWait) { let exitEvents = 0 @@ -17,7 +19,7 @@ class TestUtils { return new Promise(resolve => setTimeout(resolve, ms)) } - static async workerSleepFunction ( + static async sleepWorkerFunction ( data, ms, rejection = false, @@ -67,6 +69,19 @@ class TestUtils { return TestUtils.factorial(n - 1) * n } } + + static executeWorkerFunction (data) { + switch (data.function) { + case WorkerFunctions.jsonIntegerSerialization: + return TestUtils.jsonIntegerSerialization(data.n || 100) + case WorkerFunctions.fibonacci: + return TestUtils.fibonacci(data.n || 25) + case WorkerFunctions.factorial: + return TestUtils.factorial(data.n || 100) + default: + throw new Error('Unknown worker function') + } + } } module.exports = TestUtils diff --git a/tests/worker-files/cluster/asyncErrorWorker.js b/tests/worker-files/cluster/asyncErrorWorker.js index 0b6f5d8a..02daa5b5 100644 --- a/tests/worker-files/cluster/asyncErrorWorker.js +++ b/tests/worker-files/cluster/asyncErrorWorker.js @@ -3,7 +3,7 @@ const { ClusterWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function error (data) { - return TestUtils.workerSleepFunction( + return TestUtils.sleepWorkerFunction( data, 2000, true, diff --git a/tests/worker-files/cluster/asyncWorker.js b/tests/worker-files/cluster/asyncWorker.js index bceaffae..b9ad419f 100644 --- a/tests/worker-files/cluster/asyncWorker.js +++ b/tests/worker-files/cluster/asyncWorker.js @@ -3,7 +3,7 @@ const { ClusterWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 2000) + return TestUtils.sleepWorkerFunction(data, 2000) } module.exports = new ClusterWorker(sleep, { diff --git a/tests/worker-files/cluster/longRunningWorkerHardBehavior.js b/tests/worker-files/cluster/longRunningWorkerHardBehavior.js index 73fdad01..ec08d425 100644 --- a/tests/worker-files/cluster/longRunningWorkerHardBehavior.js +++ b/tests/worker-files/cluster/longRunningWorkerHardBehavior.js @@ -3,7 +3,7 @@ const { ClusterWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 50000) + return TestUtils.sleepWorkerFunction(data, 50000) } module.exports = new ClusterWorker(sleep, { diff --git a/tests/worker-files/cluster/longRunningWorkerSoftBehavior.js b/tests/worker-files/cluster/longRunningWorkerSoftBehavior.js index 5498752f..c1e89e1a 100644 --- a/tests/worker-files/cluster/longRunningWorkerSoftBehavior.js +++ b/tests/worker-files/cluster/longRunningWorkerSoftBehavior.js @@ -3,7 +3,7 @@ const { ClusterWorker } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 50000) + return TestUtils.sleepWorkerFunction(data, 50000) } module.exports = new ClusterWorker(sleep, { diff --git a/tests/worker-files/cluster/testWorker.js b/tests/worker-files/cluster/testWorker.js index cba1ec8e..456da63b 100644 --- a/tests/worker-files/cluster/testWorker.js +++ b/tests/worker-files/cluster/testWorker.js @@ -2,9 +2,12 @@ const { ClusterWorker, KillBehaviors } = require('../../../lib/index') const { isMaster } = require('cluster') const TestUtils = require('../../test-utils') +const WorkerFunctions = require('../../test-types') function test (data) { - TestUtils.jsonIntegerSerialization(100) + data = data || {} + data.function = data.function || WorkerFunctions.jsonIntegerSerialization + TestUtils.executeWorkerFunction(data) return isMaster } diff --git a/tests/worker-files/thread/asyncErrorWorker.js b/tests/worker-files/thread/asyncErrorWorker.js index 39f4055d..b960997f 100644 --- a/tests/worker-files/thread/asyncErrorWorker.js +++ b/tests/worker-files/thread/asyncErrorWorker.js @@ -3,7 +3,7 @@ const { ThreadWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function error (data) { - return TestUtils.workerSleepFunction( + return TestUtils.sleepWorkerFunction( data, 2000, true, diff --git a/tests/worker-files/thread/asyncWorker.js b/tests/worker-files/thread/asyncWorker.js index 6508d6da..2191a12e 100644 --- a/tests/worker-files/thread/asyncWorker.js +++ b/tests/worker-files/thread/asyncWorker.js @@ -3,7 +3,7 @@ const { ThreadWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 2000) + return TestUtils.sleepWorkerFunction(data, 2000) } module.exports = new ThreadWorker(sleep, { diff --git a/tests/worker-files/thread/longRunningWorkerHardBehavior.js b/tests/worker-files/thread/longRunningWorkerHardBehavior.js index 3c707eb5..a295da7b 100644 --- a/tests/worker-files/thread/longRunningWorkerHardBehavior.js +++ b/tests/worker-files/thread/longRunningWorkerHardBehavior.js @@ -3,7 +3,7 @@ const { ThreadWorker, KillBehaviors } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 50000) + return TestUtils.sleepWorkerFunction(data, 50000) } module.exports = new ThreadWorker(sleep, { diff --git a/tests/worker-files/thread/longRunningWorkerSoftBehavior.js b/tests/worker-files/thread/longRunningWorkerSoftBehavior.js index 65195d6f..2c7b03b7 100644 --- a/tests/worker-files/thread/longRunningWorkerSoftBehavior.js +++ b/tests/worker-files/thread/longRunningWorkerSoftBehavior.js @@ -3,7 +3,7 @@ const { ThreadWorker } = require('../../../lib/index') const TestUtils = require('../../test-utils') async function sleep (data) { - return TestUtils.workerSleepFunction(data, 50000) + return TestUtils.sleepWorkerFunction(data, 50000) } module.exports = new ThreadWorker(sleep, { diff --git a/tests/worker-files/thread/testWorker.js b/tests/worker-files/thread/testWorker.js index 773e1116..e6bc434b 100644 --- a/tests/worker-files/thread/testWorker.js +++ b/tests/worker-files/thread/testWorker.js @@ -2,9 +2,12 @@ const { ThreadWorker, KillBehaviors } = require('../../../lib/index') const { isMainThread } = require('worker_threads') const TestUtils = require('../../test-utils') +const WorkerFunctions = require('../../test-types') function test (data) { - TestUtils.jsonIntegerSerialization(100) + data = data || {} + data.function = data.function || WorkerFunctions.jsonIntegerSerialization + TestUtils.executeWorkerFunction(data) return isMainThread }