Merge pull request #52 from pioardi/dependabot/npm_and_yarn/mocha-8.2.0
[poolifier.git] / tests / dynamic.test.js
index 3784c65110b5161cbd9bb9a25b8eff0c0047d9ec..e8be74ace413c874a008dbd846c2ec98811d46cb 100644 (file)
@@ -3,7 +3,7 @@ const DynamicThreadPool = require('../lib/dynamic')
 const min = 1
 const max = 3
 const pool = new DynamicThreadPool(min, max,
-  './tests/testWorker.js',
+  './tests/workers/testWorker.js',
   { errorHandler: (e) => console.error(e), onlineHandler: () => console.log('worker is online') })
 
 describe('Dynamic thread pool test suite ', () => {
@@ -39,8 +39,7 @@ describe('Dynamic thread pool test suite ', () => {
         closedThreads++
       })
     })
-    pool.destroy()
-    await new Promise(resolve => setTimeout(resolve, 2000))
+    await pool.destroy()
     expect(closedThreads).toBe(min)
   })
 
@@ -57,7 +56,7 @@ describe('Dynamic thread pool test suite ', () => {
   })
 
   it('Should work even without opts in input', async () => {
-    const pool1 = new DynamicThreadPool(1, 1, './tests/testWorker.js')
+    const pool1 = new DynamicThreadPool(1, 1, './tests/workers/testWorker.js')
     const res = await pool1.execute({ test: 'test' })
     expect(res).toBeFalsy()
   })