+ const pool = new DynamicThreadPool(
+ min,
+ max,
+ './tests/worker-files/thread/testWorker.js'
+ )
+ const res = await pool.execute()
+ expect(res).toStrictEqual({ ok: 1 })
+ // We need to clean up the resources after our test
+ await pool.destroy()
+ })
+
+ it('Verify scale thread up and down is working when long executing task is used:hard', async () => {
+ const longRunningPool = new DynamicThreadPool(
+ min,
+ max,
+ './tests/worker-files/thread/longRunningWorkerHardBehavior.js',
+ {
+ errorHandler: e => console.error(e),
+ onlineHandler: () => console.info('long executing worker is online'),
+ exitHandler: () => console.info('long executing worker exited')
+ }