X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fabstract%2Fabstract-pool.test.js;h=5af1591207feca5269881d640db718b351aa66f3;hb=90d7d101196cf9702ccc1d220dd33cca67a427b0;hp=d5b105497dc5297bc9af5d1e000a51624979ff5e;hpb=9edb9717ae4c1c86bd7d28553eaa1ef141fc133b;p=poolifier.git diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index d5b10549..5af15912 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -841,11 +841,37 @@ describe('Abstract pool test suite', () => { await pool.destroy() }) - it('Verify that multiple tasks worker is working', async () => { + it('Verify that listTaskFunctions() is working', async () => { + const dynamicThreadPool = new DynamicThreadPool( + Math.floor(numberOfWorkers / 2), + numberOfWorkers, + './tests/worker-files/thread/testMultipleTaskFunctionsWorker.js' + ) + await waitPoolEvents(dynamicThreadPool, PoolEvents.ready, 1) + expect(dynamicThreadPool.listTaskFunctions()).toStrictEqual([ + 'default', + 'jsonIntegerSerialization', + 'factorial', + 'fibonacci' + ]) + const fixedClusterPool = new FixedClusterPool( + numberOfWorkers, + './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js' + ) + await waitPoolEvents(fixedClusterPool, PoolEvents.ready, 1) + expect(fixedClusterPool.listTaskFunctions()).toStrictEqual([ + 'default', + 'jsonIntegerSerialization', + 'factorial', + 'fibonacci' + ]) + }) + + it('Verify that multiple task functions worker is working', async () => { const pool = new DynamicClusterPool( Math.floor(numberOfWorkers / 2), numberOfWorkers, - './tests/worker-files/cluster/testMultiTasksWorker.js' + './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js' ) const data = { n: 10 } const result0 = await pool.execute(data)